diff mbox

[4/4] ASoC: Intel: add NULL test

Message ID 1450610153-7746-5-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State Accepted
Commit 3f317c9faabc546a503bc62e806fa2e8e93e76be
Headers show

Commit Message

Julia Lawall Dec. 20, 2015, 11:15 a.m. UTC
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>

---
 sound/soc/intel/baytrail/sst-baytrail-pcm.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Brown Dec. 23, 2015, 12:02 a.m. UTC | #1
On Sun, Dec 20, 2015 at 12:15:53PM +0100, 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/)

If there was a patch 3 in this series I seem to be missing it.
Julia Lawall Dec. 23, 2015, 6:58 a.m. UTC | #2
On Wed, 23 Dec 2015, Mark Brown wrote:

> On Sun, Dec 20, 2015 at 12:15:53PM +0100, 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/)
> 
> If there was a patch 3 in this series I seem to be missing it.

It's not for you (drivers/s390/char/con3215.c).  Sorry for the confusion.

julia
diff mbox

Patch

diff --git a/sound/soc/intel/baytrail/sst-baytrail-pcm.c b/sound/soc/intel/baytrail/sst-baytrail-pcm.c
index 79547be..4765ad4 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-pcm.c
+++ b/sound/soc/intel/baytrail/sst-baytrail-pcm.c
@@ -377,6 +377,8 @@  static int sst_byt_pcm_probe(struct snd_soc_platform *platform)
 
 	priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data),
 				 GFP_KERNEL);
+	if (!priv_data)
+		return -ENOMEM;
 	priv_data->byt = plat_data->dsp;
 	snd_soc_platform_set_drvdata(platform, priv_data);