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


Groups > linux.kernel > #1295562

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

From Julia Lawall <Julia.Lawall@lip6.fr>
Newsgroups linux.kernel
Subject [PATCH 4/4] ASoC: Intel: add NULL test
Date 2015-12-20 12:30 +0100
Message-ID <qHKlA-8mk-1@gated-at.bofh.it> (permalink)
References <qHKlA-8mk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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(+)

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);
 

--
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 | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] ASoC: Intel: add NULL test Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-20 12:30 +0100
  Re: [PATCH 4/4] ASoC: Intel: add NULL test Mark Brown <broonie@kernel.org> - 2015-12-23 01:10 +0100
    Re: [PATCH 4/4] ASoC: Intel: add NULL test Julia Lawall <julia.lawall@lip6.fr> - 2015-12-23 08:00 +0100

csiph-web