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>
Thu, 3 Aug 2023 08:44:02 +0000 (17:44 +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 4aa48c7..4b9fa37 100644 (file)
@@ -117,6 +117,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);