alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open
@ 2012-09-18  9:20 Richard Zhao
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Zhao @ 2012-09-18  9:20 UTC (permalink / raw)
  To: alsa-devel; +Cc: s.hauer, shawn.guo, Richard Zhao, lrg, broonie

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-19  2:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18  9:20 [PATCH 1/2] ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open Richard Zhao
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

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