From: Lars-Peter Clausen Date: Tue, 28 May 2013 17:22:12 +0000 (+0200) Subject: ASoC: blackfin: bf5xx-i2s: Allocate buffer only as large as requested X-Git-Tag: firefly_0821_release~176^2~5489^2~16^2~1^2~31^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=569ef65a973e19ec3327c8efbcf26bfc844af7e3;p=firefly-linux-kernel-4.4.55.git ASoC: blackfin: bf5xx-i2s: Allocate buffer only as large as requested 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 Signed-off-by: Mark Brown --- diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 8726c3ad4947..107c1c9b1cb6 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c @@ -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)