Alsa-Devel Archive on
 help / color / Atom feed
From: Takashi Iwai <>
Subject: [alsa-devel] [PATCH 1/2] ALSA: pcm: Warn if doubly preallocated
Date: Tue,  5 Nov 2019 20:10:06 +0100
Message-ID: <> (raw)
In-Reply-To: <>

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.

Signed-off-by: Takashi Iwai <>
 sound/core/pcm_memory.c | 2 ++
 1 file changed, 2 insertions(+)

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->
+		return;
 	substream-> = type;
 	substream-> = data;
 	snd_pcm_lib_preallocate_pages1(substream, size, max);

Alsa-devel mailing list

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 19:10 [alsa-devel] [PATCH 0/2] ALSA: pcm: minor enhancements Takashi Iwai
2019-11-05 19:10 ` Takashi Iwai [this message]
2019-11-05 19:10 ` [alsa-devel] [PATCH 2/2] ALSA: pcm: Create proc files only for non-empty preallocations Takashi Iwai

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Alsa-Devel Archive on

Archives are clonable:
	git clone --mirror alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ \
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone