From: Julia Lawall Date: Sun, 20 Dec 2015 11:15:51 +0000 (+0100) Subject: ASoC: omap-hdmi-audio: add NULL test X-Git-Tag: v4.14-rc1~3939^2~37^2~1^2~9^3~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=18c94a043d6a466938f13761081a5cbee802dad1;p=platform%2Fkernel%2Flinux-rpi.git ASoC: omap-hdmi-audio: add NULL test Add NULL test on call to devm_kzalloc. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; identifier fld; @@ * x = devm_kzalloc(...); ... when != x == NULL x->fld // Signed-off-by: Julia Lawall Acked-by: Peter Ujfalusi Signed-off-by: Mark Brown --- diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c index 584b2372..f83cc2b 100644 --- a/sound/soc/omap/omap-hdmi-audio.c +++ b/sound/soc/omap/omap-hdmi-audio.c @@ -368,6 +368,8 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev) card->owner = THIS_MODULE; card->dai_link = devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL); + if (!card->dai_link) + return -ENOMEM; card->dai_link->name = card->name; card->dai_link->stream_name = card->name; card->dai_link->cpu_dai_name = dev_name(ad->dssdev);