From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 9AA8C1A0C38 for ; Mon, 21 Dec 2015 18:34:37 +1100 (AEDT) Received: by mail-pa0-x235.google.com with SMTP id wq6so95359529pac.1 for ; Sun, 20 Dec 2015 23:34:37 -0800 (PST) Date: Sun, 20 Dec 2015 23:34:32 -0800 From: Nicolin Chen To: Julia Lawall Cc: Timur Tabi , kernel-janitors@vger.kernel.org, Xiubo Li , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] ASoC: imx-pcm-dma: add NULL test Message-ID: <20151221073431.GD3524@Asurada-CZ80> References: <1450610153-7746-1-git-send-email-Julia.Lawall@lip6.fr> <1450610153-7746-2-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1450610153-7746-2-git-send-email-Julia.Lawall@lip6.fr> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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/) > > // > @@ > expression x; > @@ > > * x = devm_kzalloc(...); > ... when != x == NULL > *x > // > > Signed-off-by: Julia Lawall Acked-by: Nicolin Chen 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; >