Skip to content

Commit

Permalink
ALSA: pcm: Fix mmap breakage without explicit buffer setup
Browse files Browse the repository at this point in the history
The recent fix c4824ae ("ALSA: pcm: Fix mmap capability check")
restricts the mmap capability only to the drivers that properly set up
the buffers, but it caused a regression for a few drivers that manage
the buffer on its own way.

For those with UNKNOWN buffer type (i.e. the uninitialized / unused
substream->dma_buffer), just assume that the driver handles the mmap
properly and blindly trust the hardware info bit.

Fixes: c4824ae ("ALSA: pcm: Fix mmap capability check")
Reported-and-tested-by: Jeff Woods <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Aug 9, 2021
1 parent 739d095 commit dc0dc8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream)

switch (substream->dma_buffer.dev.type) {
case SNDRV_DMA_TYPE_UNKNOWN:
return false;
/* we can't know the device, so just assume that the driver does
* everything right
*/
return true;
case SNDRV_DMA_TYPE_CONTINUOUS:
case SNDRV_DMA_TYPE_VMALLOC:
return true;
Expand Down

0 comments on commit dc0dc8a

Please sign in to comment.