ASoC: blackfin: bf5xx-i2s: Allocate buffer only as large as requested
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 28 May 2013 17:22:12 +0000 (19:22 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 30 May 2013 11:33:40 +0000 (12:33 +0100)
There is no need to always allocate the maximum buffer size. While we are at it
also pass errors returned by snd_pcm_lib_malloc_pages() on to the upper layers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/blackfin/bf5xx-i2s-pcm.c

index 8726c3a..107c1c9 100644 (file)
@@ -66,10 +66,7 @@ static const struct snd_pcm_hardware bf5xx_pcm_hardware = {
 static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params)
 {
-       size_t size = bf5xx_pcm_hardware.buffer_bytes_max;
-       snd_pcm_lib_malloc_pages(substream, size);
-
-       return 0;
+       return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
 }
 
 static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream)