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

Takashi Iwai tiwai at suse.de
Wed Nov 21 10:45:50 CET 2012


At Wed, 21 Nov 2012 14:36:58 +0530,
Sachin Kamat wrote:
> 
> 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>

There are some other places returning -1 around this.
Could you fix them as well to sensitive values?


thanks,

Takashi


> ---
> 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