| From stable-bounces@linux.kernel.org Tue Feb 6 10:13:42 2007 |
| From: Takashi Iwai <tiwai@suse.de> |
| Date: Tue, 06 Feb 2007 19:12:11 +0100 |
| Subject: USB audio fixes 1 |
| To: stable@kernel.org |
| Message-ID: <s5h3b5jw3yc.wl%tiwai@suse.de> |
| |
| From: Takashi Iwai <tiwai@suse.de> |
| |
| [PATCH] usbaudio - Fix Oops with broken usb descriptors |
| |
| This is a patch for ALSA Bug #2724. Some webcams provide bogus |
| settings with no valid rates. With this patch those are skipped. |
| |
| Signed-off-by: Gregor Jasny <gjasny@web.de> |
| Signed-off-by: Takashi Iwai <tiwai@suse.de> |
| Signed-off-by: Jaroslav Kysela <perex@suse.cz> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> |
| |
| --- |
| sound/usb/usbaudio.c | 6 ++++++ |
| 1 file changed, 6 insertions(+) |
| |
| --- linux-2.6.20.1.orig/sound/usb/usbaudio.c |
| +++ linux-2.6.20.1/sound/usb/usbaudio.c |
| @@ -2456,6 +2456,7 @@ static int parse_audio_format_rates(stru |
| * build the rate table and bitmap flags |
| */ |
| int r, idx, c; |
| + unsigned int nonzero_rates = 0; |
| /* this table corresponds to the SNDRV_PCM_RATE_XXX bit */ |
| static unsigned int conv_rates[] = { |
| 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, |
| @@ -2478,6 +2479,7 @@ static int parse_audio_format_rates(stru |
| fp->altsetting == 5 && fp->maxpacksize == 392) |
| rate = 96000; |
| fp->rate_table[r] = rate; |
| + nonzero_rates |= rate; |
| if (rate < fp->rate_min) |
| fp->rate_min = rate; |
| else if (rate > fp->rate_max) |
| @@ -2493,6 +2495,10 @@ static int parse_audio_format_rates(stru |
| if (!found) |
| fp->needs_knot = 1; |
| } |
| + if (!nonzero_rates) { |
| + hwc_debug("All rates were zero. Skipping format!\n"); |
| + return -1; |
| + } |
| if (fp->needs_knot) |
| fp->rates |= SNDRV_PCM_RATE_KNOT; |
| } else { |