summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-11-05 20:10:06 +0100
committerTakashi Iwai <tiwai@suse.de>2019-11-06 15:43:34 +0100
commita55eaf177a36f7789eec0985a7edd00fe7353d90 (patch)
tree29ea58d2b200ff97f32f3c3583687cae461b3c95 /sound/core
parentALSA: docs: Update documentation about SG- and vmalloc-buffers (diff)
downloadlinux-a55eaf177a36f7789eec0985a7edd00fe7353d90.tar.xz
linux-a55eaf177a36f7789eec0985a7edd00fe7353d90.zip
ALSA: pcm: Warn if doubly preallocated
Warn if snd_pcm_lib_preallocate_pages*() is applied to the stream that has already the preallocated buffers and skip the allocation. It's a clearly a driver bug. Link: https://lore.kernel.org/r/20191105191007.18150-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_memory.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 7600dcdf5fd4..19407f79b638 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -221,6 +221,8 @@ void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data,
size_t size, size_t max)
{
+ if (snd_BUG_ON(substream->dma_buffer.dev.type))
+ return;
substream->dma_buffer.dev.type = type;
substream->dma_buffer.dev.dev = data;
snd_pcm_lib_preallocate_pages1(substream, size, max);