]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ASoC: imx-pcm-dma: add NULL test
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 20 Dec 2015 11:15:50 +0000 (12:15 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 23 Dec 2015 00:01:53 +0000 (00:01 +0000)
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;
@@

* x = devm_kzalloc(...);
  ... when != x == NULL
  *x
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/imx-pcm-dma.c

index 1fc01ed3279dbee0991a343c082aa6c9ea5f042b..f3d3d1ffa84e4257029495785ca88e72cb013533 100644 (file)
@@ -62,6 +62,8 @@ int imx_pcm_dma_init(struct platform_device *pdev, size_t size)
 
        config = devm_kzalloc(&pdev->dev,
                        sizeof(struct snd_dmaengine_pcm_config), GFP_KERNEL);
+       if (!config)
+               return -ENOMEM;
        *config = imx_dmaengine_pcm_config;
        if (size)
                config->prealloc_buffer_size = size;