[alsa-devel] [PATCH 5/6] ALSA: usb-audio: Return -ENOMEM on memory alloc failure in format.c

Sachin Kamat sachin.kamat at linaro.org
Wed Nov 21 10:06:58 CET 2012


Return -ENOMEM instead of -1 to silence the following smatch warning:
sound/usb/format.c:170 parse_audio_format_rates_v1() warn:
returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
---
Build tested and based on linux-next 20121115.
---
 sound/usb/format.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/usb/format.c b/sound/usb/format.c
index ddfef57..d033d4d 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -167,7 +167,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
 		fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
 		if (fp->rate_table == NULL) {
 			snd_printk(KERN_ERR "cannot malloc\n");
-			return -1;
+			return -ENOMEM;
 		}
 
 		fp->nr_rates = 0;
-- 
1.7.4.1



More information about the Alsa-devel mailing list