diff options
Diffstat (limited to 'sound/usb/format.c')
-rw-r--r-- | sound/usb/format.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c index 3a1375459c06..69148212aa70 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c | |||
@@ -49,7 +49,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
49 | u64 pcm_formats; | 49 | u64 pcm_formats; |
50 | 50 | ||
51 | switch (protocol) { | 51 | switch (protocol) { |
52 | case UAC_VERSION_1: { | 52 | case UAC_VERSION_1: |
53 | default: { | ||
53 | struct uac_format_type_i_discrete_descriptor *fmt = _fmt; | 54 | struct uac_format_type_i_discrete_descriptor *fmt = _fmt; |
54 | sample_width = fmt->bBitResolution; | 55 | sample_width = fmt->bBitResolution; |
55 | sample_bytes = fmt->bSubframeSize; | 56 | sample_bytes = fmt->bSubframeSize; |
@@ -64,9 +65,6 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
64 | format <<= 1; | 65 | format <<= 1; |
65 | break; | 66 | break; |
66 | } | 67 | } |
67 | |||
68 | default: | ||
69 | return -EINVAL; | ||
70 | } | 68 | } |
71 | 69 | ||
72 | pcm_formats = 0; | 70 | pcm_formats = 0; |
@@ -384,6 +382,10 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, | |||
384 | * audio class v2 uses class specific EP0 range requests for that. | 382 | * audio class v2 uses class specific EP0 range requests for that. |
385 | */ | 383 | */ |
386 | switch (protocol) { | 384 | switch (protocol) { |
385 | default: | ||
386 | snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n", | ||
387 | chip->dev->devnum, fp->iface, fp->altsetting, protocol); | ||
388 | /* fall through */ | ||
387 | case UAC_VERSION_1: | 389 | case UAC_VERSION_1: |
388 | fp->channels = fmt->bNrChannels; | 390 | fp->channels = fmt->bNrChannels; |
389 | ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); | 391 | ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); |
@@ -392,10 +394,6 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, | |||
392 | /* fp->channels is already set in this case */ | 394 | /* fp->channels is already set in this case */ |
393 | ret = parse_audio_format_rates_v2(chip, fp); | 395 | ret = parse_audio_format_rates_v2(chip, fp); |
394 | break; | 396 | break; |
395 | default: | ||
396 | snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n", | ||
397 | chip->dev->devnum, fp->iface, fp->altsetting, protocol); | ||
398 | return -EINVAL; | ||
399 | } | 397 | } |
400 | 398 | ||
401 | if (fp->channels < 1) { | 399 | if (fp->channels < 1) { |
@@ -438,6 +436,10 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, | |||
438 | fp->channels = 1; | 436 | fp->channels = 1; |
439 | 437 | ||
440 | switch (protocol) { | 438 | switch (protocol) { |
439 | default: | ||
440 | snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n", | ||
441 | chip->dev->devnum, fp->iface, fp->altsetting, protocol); | ||
442 | /* fall through */ | ||
441 | case UAC_VERSION_1: { | 443 | case UAC_VERSION_1: { |
442 | struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; | 444 | struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; |
443 | brate = le16_to_cpu(fmt->wMaxBitRate); | 445 | brate = le16_to_cpu(fmt->wMaxBitRate); |
@@ -456,10 +458,6 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, | |||
456 | ret = parse_audio_format_rates_v2(chip, fp); | 458 | ret = parse_audio_format_rates_v2(chip, fp); |
457 | break; | 459 | break; |
458 | } | 460 | } |
459 | default: | ||
460 | snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n", | ||
461 | chip->dev->devnum, fp->iface, fp->altsetting, protocol); | ||
462 | return -EINVAL; | ||
463 | } | 461 | } |
464 | 462 | ||
465 | return ret; | 463 | return ret; |