* [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
* [PATCH 2/2] ASoC: imx-pcm-dma: open function failed when snd_dmaengine_pcm_open fail
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 ` 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
1 sibling, 0 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
snd_imx_open should return error code returned by snd_dmaengine_pcm_open.
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
---
sound/soc/fsl/imx-pcm-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index a23505a..9a15bc4 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -120,7 +120,7 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
ret = snd_dmaengine_pcm_open(substream, filter, dma_data);
if (ret) {
kfree(dma_data);
- return 0;
+ return ret;
}
snd_dmaengine_pcm_set_data(substream, dma_data);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open
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 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-09-19 2:52 UTC (permalink / raw)
To: Richard Zhao; +Cc: alsa-devel, shawn.guo, s.hauer, lrg
On Tue, Sep 18, 2012 at 05:20:05PM +0800, Richard Zhao wrote:
> It fixed smatch warning:
> sound/soc/fsl/imx-pcm-dma.c:112 snd_imx_open() error: potential null dereference 'dma_data'. (kzalloc returns null)
Applied both, thanks.
^ permalink raw reply [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).