Commit 38d7b08f authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: sound/usb/format: silence uninitialized variable warnings

Gcc complains that ret might be used uninitialized:

sound/usb/format.c: In function ‘snd_usb_parse_audio_format’:
sound/usb/format.c:354: warning: ‘ret’ may be used uninitialized in this function
sound/usb/format.c:354: note: ‘ret’ was declared here
sound/usb/format.c:414: warning: ‘ret’ may be used uninitialized in this function
sound/usb/format.c:414: note: ‘ret’ was declared here

I suppose it could be uninitialized if there is ever a UAC_VERSION_3
released. Anyway this patch is worthwhile if only to silence the gcc
warning.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarDaniel Mack <daniel@caiaq.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 31cbd977
...@@ -392,6 +392,10 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, ...@@ -392,6 +392,10 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
/* fp->channels is already set in this case */ /* fp->channels is already set in this case */
ret = parse_audio_format_rates_v2(chip, fp); ret = parse_audio_format_rates_v2(chip, fp);
break; break;
default:
snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
chip->dev->devnum, fp->iface, fp->altsetting, protocol);
return -EINVAL;
} }
if (fp->channels < 1) { if (fp->channels < 1) {
...@@ -452,6 +456,10 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, ...@@ -452,6 +456,10 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
ret = parse_audio_format_rates_v2(chip, fp); ret = parse_audio_format_rates_v2(chip, fp);
break; break;
} }
default:
snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
chip->dev->devnum, fp->iface, fp->altsetting, protocol);
return -EINVAL;
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment