lkml.org 
[lkml]   [2021]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 3/6] ALSA: pcm: Check for substream->ops before substream->ops->mmap
Date
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@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
\
 
 \ /
  Last update: 2021-05-19 12:50    [W:0.103 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site