Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1295872

Re: [PATCH 2/4] ASoC: omap-hdmi-audio: add NULL test

From Peter Ujfalusi <peter.ujfalusi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] ASoC: omap-hdmi-audio: add NULL test
Date 2015-12-21 10:40 +0100
Message-ID <qI56G-4HQ-5@gated-at.bofh.it> (permalink)
References <qHKlA-8mk-3@gated-at.bofh.it> <qHKlA-8mk-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 12/20/2015 01:15 PM, Julia Lawall wrote:
> Add NULL test on call to devm_kzalloc.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x;
> identifier fld;
> @@
> 
> * x = devm_kzalloc(...);
>   ... when != x == NULL
>   x->fld
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---
>  sound/soc/omap/omap-hdmi-audio.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
> index 584b237..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);
> 


-- 
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 2/4] ASoC: omap-hdmi-audio: add NULL test Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-20 12:30 +0100
  Re: [PATCH 2/4] ASoC: omap-hdmi-audio: add NULL test Peter Ujfalusi <peter.ujfalusi@ti.com> - 2015-12-21 10:40 +0100

csiph-web