diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-11-21 04:55:56 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-11-21 05:31:52 -0500 |
commit | 8ad10dc6d3fe8396d8213af4d5ce58e0010a3cbc (patch) | |
tree | d337b1833405ef5f9d7267137389bcbe8fbc75ef /sound/usb | |
parent | 27b2a22c714303d1920e269a8322ff23107694ee (diff) |
ALSA: usb-audio: Return meaningful error codes instead of -1 in format.c
Also, silences 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@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/format.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c index ddfef57c4c9f..e831ee4238bb 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c | |||
@@ -155,7 +155,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
155 | if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { | 155 | if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { |
156 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", | 156 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", |
157 | chip->dev->devnum, fp->iface, fp->altsetting); | 157 | chip->dev->devnum, fp->iface, fp->altsetting); |
158 | return -1; | 158 | return -EINVAL; |
159 | } | 159 | } |
160 | 160 | ||
161 | if (nr_rates) { | 161 | if (nr_rates) { |
@@ -167,7 +167,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
167 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); | 167 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); |
168 | if (fp->rate_table == NULL) { | 168 | if (fp->rate_table == NULL) { |
169 | snd_printk(KERN_ERR "cannot malloc\n"); | 169 | snd_printk(KERN_ERR "cannot malloc\n"); |
170 | return -1; | 170 | return -ENOMEM; |
171 | } | 171 | } |
172 | 172 | ||
173 | fp->nr_rates = 0; | 173 | fp->nr_rates = 0; |
@@ -198,7 +198,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof | |||
198 | } | 198 | } |
199 | if (!fp->nr_rates) { | 199 | if (!fp->nr_rates) { |
200 | hwc_debug("All rates were zero. Skipping format!\n"); | 200 | hwc_debug("All rates were zero. Skipping format!\n"); |
201 | return -1; | 201 | return -EINVAL; |
202 | } | 202 | } |
203 | } else { | 203 | } else { |
204 | /* continuous rates */ | 204 | /* continuous rates */ |
@@ -383,7 +383,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, | |||
383 | fp->formats = parse_audio_format_i_type(chip, fp, format, | 383 | fp->formats = parse_audio_format_i_type(chip, fp, format, |
384 | fmt, protocol); | 384 | fmt, protocol); |
385 | if (!fp->formats) | 385 | if (!fp->formats) |
386 | return -1; | 386 | return -EINVAL; |
387 | } | 387 | } |
388 | 388 | ||
389 | /* gather possible sample rates */ | 389 | /* gather possible sample rates */ |
@@ -409,7 +409,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, | |||
409 | if (fp->channels < 1) { | 409 | if (fp->channels < 1) { |
410 | snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", | 410 | snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", |
411 | chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); | 411 | chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); |
412 | return -1; | 412 | return -EINVAL; |
413 | } | 413 | } |
414 | 414 | ||
415 | return ret; | 415 | return ret; |