diff options
author | Richard Zhao <richard.zhao@freescale.com> | 2012-09-18 11:20:05 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-19 04:52:42 +0200 |
commit | d37777a13b4c4b32e274013846d739e5bbbf6f8d (patch) | |
tree | daa49428c3c524fad44eefaa8bfa1ca4dbead2f5 /sound/soc/fsl/imx-pcm-dma.c | |
parent | ASoC: Avoid recalculating the bitmask for SOC_ENUM controls (diff) | |
download | linux-d37777a13b4c4b32e274013846d739e5bbbf6f8d.tar.xz linux-d37777a13b4c4b32e274013846d739e5bbbf6f8d.zip |
ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl/imx-pcm-dma.c')
-rw-r--r-- | sound/soc/fsl/imx-pcm-dma.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index 48f9d886f020..a23505a9ae64 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; |