diff options
-rw-r--r-- | sound/usb/usbaudio.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index de680d095e94..56e42b88addf 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2463,6 +2463,7 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2463 | * build the rate table and bitmap flags | 2463 | * build the rate table and bitmap flags |
2464 | */ | 2464 | */ |
2465 | int r, idx, c; | 2465 | int r, idx, c; |
2466 | unsigned int nonzero_rates = 0; | ||
2466 | /* this table corresponds to the SNDRV_PCM_RATE_XXX bit */ | 2467 | /* this table corresponds to the SNDRV_PCM_RATE_XXX bit */ |
2467 | static unsigned int conv_rates[] = { | 2468 | static unsigned int conv_rates[] = { |
2468 | 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, | 2469 | 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, |
@@ -2485,6 +2486,7 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2485 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2486 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2486 | rate = 96000; | 2487 | rate = 96000; |
2487 | fp->rate_table[r] = rate; | 2488 | fp->rate_table[r] = rate; |
2489 | nonzero_rates |= rate; | ||
2488 | if (rate < fp->rate_min) | 2490 | if (rate < fp->rate_min) |
2489 | fp->rate_min = rate; | 2491 | fp->rate_min = rate; |
2490 | else if (rate > fp->rate_max) | 2492 | else if (rate > fp->rate_max) |
@@ -2500,6 +2502,10 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2500 | if (!found) | 2502 | if (!found) |
2501 | fp->needs_knot = 1; | 2503 | fp->needs_knot = 1; |
2502 | } | 2504 | } |
2505 | if (!nonzero_rates) { | ||
2506 | hwc_debug("All rates were zero. Skipping format!\n"); | ||
2507 | return -1; | ||
2508 | } | ||
2503 | if (fp->needs_knot) | 2509 | if (fp->needs_knot) |
2504 | fp->rates |= SNDRV_PCM_RATE_KNOT; | 2510 | fp->rates |= SNDRV_PCM_RATE_KNOT; |
2505 | } else { | 2511 | } else { |