ASoC: dmaengine: Add check to dma_dev
authorHoegeun Kwon <hoegeun.kwon@samsung.com>
Wed, 20 May 2020 07:41:06 +0000 (16:41 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Mon, 6 Jul 2020 09:09:48 +0000 (18:09 +0900)
A segmentation fault occurs when dma_dev is null. Add error handling
for dma_dev.

Change-Id: Ie8fa0b355c92bf59b937e3a5a399f8b299f94c74
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
sound/soc/soc-generic-dmaengine-pcm.c

index 5552c66..c38a1c4 100644 (file)
@@ -126,6 +126,9 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea
        snd_pcm_format_t i;
        int ret;
 
+       if (!dma_dev)
+               return -ENODEV;
+
        if (pcm->config && pcm->config->pcm_hardware)
                return snd_soc_set_runtime_hwparams(substream,
                                pcm->config->pcm_hardware);