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


Groups > linux.kernel > #1295564 > unrolled thread

[PATCH 1/4] ASoC: imx-pcm-dma: add NULL test

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2015-12-20 12:30 +0100
Last post2015-12-21 08:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/4] ASoC: imx-pcm-dma: add NULL test Julia Lawall <Julia.Lawall@lip6.fr> - 2015-12-20 12:30 +0100
    Re: [PATCH 1/4] ASoC: imx-pcm-dma: add NULL test Nicolin Chen <nicoleotsuka@gmail.com> - 2015-12-21 08:40 +0100

#1295564 — [PATCH 1/4] ASoC: imx-pcm-dma: add NULL test

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2015-12-20 12:30 +0100
Subject[PATCH 1/4] ASoC: imx-pcm-dma: add NULL test
Message-ID<qHKlA-8mk-13@gated-at.bofh.it>
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>

---
 sound/soc/fsl/imx-pcm-dma.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 1fc01ed..f3d3d1f 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -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;

--
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/

[toc] | [next] | [standalone]


#1295798

FromNicolin Chen <nicoleotsuka@gmail.com>
Date2015-12-21 08:40 +0100
Message-ID<qI3ex-3xA-7@gated-at.bofh.it>
In reply to#1295564
On Sun, Dec 20, 2015 at 12:15:50PM +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/)
> 
> // <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>

Thank you

> 
> ---
>  sound/soc/fsl/imx-pcm-dma.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
> index 1fc01ed..f3d3d1f 100644
> --- a/sound/soc/fsl/imx-pcm-dma.c
> +++ b/sound/soc/fsl/imx-pcm-dma.c
> @@ -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;
> 
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web