alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Richard Zhao <richard.zhao@freescale.com>
To: alsa-devel@alsa-project.org
Cc: s.hauer@pengutronix.de, shawn.guo@linaro.org,
	Richard Zhao <richard.zhao@freescale.com>,
	lrg@ti.com, broonie@opensource.wolfsonmicro.com
Subject: [PATCH 1/2] ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open
Date: Tue, 18 Sep 2012 17:20:05 +0800	[thread overview]
Message-ID: <1347960006-23681-1-git-send-email-richard.zhao@freescale.com> (raw)

It fixed smatch warning:
sound/soc/fsl/imx-pcm-dma.c:112 snd_imx_open() error: potential null dereference 'dma_data'.  (kzalloc returns null)

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
---
 sound/soc/fsl/imx-pcm-dma.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index 48f9d88..a23505a 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -109,6 +109,9 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
 	dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 
 	dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL);
+	if (!dma_data)
+		return -ENOMEM;
+
 	dma_data->peripheral_type = dma_params->shared_peripheral ?
 					IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI;
 	dma_data->priority = DMA_PRIO_HIGH;
-- 
1.7.9.5

             reply	other threads:[~2012-09-18  9:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  9:20 Richard Zhao [this message]
2012-09-18  9:20 ` [PATCH 2/2] ASoC: imx-pcm-dma: open function failed when snd_dmaengine_pcm_open fail Richard Zhao
2012-09-19  2:52 ` [PATCH 1/2] ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347960006-23681-1-git-send-email-richard.zhao@freescale.com \
    --to=richard.zhao@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).