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>
Tue, 30 Mar 2021 01:40:01 +0000 (10:40 +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 9ef80a4..738098f 100644 (file)
@@ -118,6 +118,9 @@ dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
                return -EINVAL;
        }
 
+       if (!dma_dev)
+               return -ENODEV;
+
        if (pcm->config && pcm->config->pcm_hardware)
                return snd_soc_set_runtime_hwparams(substream,
                                pcm->config->pcm_hardware);