[RFC PATCH 3/6] ALSA: pcm: Check for substream->ops before substream->ops->mmap

Codrin Ciubotariu codrin.ciubotariu at microchip.com
Wed May 19 12:48:39 CEST 2021


substreams, like the internal ones, might not have ops set. Check it,
before looking at substream->ops->mmap.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu at microchip.com>
---
 sound/core/pcm_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 54e0eab2a57e..cb0164d55593 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -246,7 +246,7 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream)
 	if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP))
 		return false;
 
-	if (substream->ops->mmap ||
+	if ((substream->ops && substream->ops->mmap) ||
 	    (substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV &&
 	     substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV_UC))
 		return true;
-- 
2.27.0



More information about the Alsa-devel mailing list