ALSA: PCM: Warn when buffer preallocation fails
authorTakashi Iwai <tiwai@suse.de>
Fri, 10 Jan 2014 12:01:41 +0000 (13:01 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 11 Jan 2014 10:04:23 +0000 (11:04 +0100)
The failures of buffer preallocations at driver initializations aren't
critical but it's still helpful to inform, so that user can know that
something doesn't work as expected.

For example, the recent page allocator change triggered regressions,
but developers didn't notice until recently because the driver didn't
complain.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_memory.c

index 01f8eafebda605d5502b7ca01ef7fce3e6fb2cee..54debc07f5cbb233a2249e4bf957855adbfac25b 100644 (file)
@@ -51,6 +51,7 @@ static const size_t snd_minimum_buffer = 16384;
 static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size)
 {
        struct snd_dma_buffer *dmab = &substream->dma_buffer;
+       size_t orig_size = size;
        int err;
 
        do {
@@ -63,6 +64,10 @@ static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t siz
                size >>= 1;
        } while (size >= snd_minimum_buffer);
        dmab->bytes = 0; /* tell error */
+       pr_warn("ALSA pcmC%dD%d%c,%d:%s: cannot preallocate for size %zu\n",
+               substream->pcm->card->number, substream->pcm->device,
+               substream->stream ? 'c' : 'p', substream->number,
+               substream->pcm->name, orig_size);
        return 0;
 }