]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.20.2/usb-audio-fixes-1.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.20.2 / usb-audio-fixes-1.patch
CommitLineData
2bb74eb3
GKH
1From stable-bounces@linux.kernel.org Tue Feb 6 10:13:42 2007
2From: Takashi Iwai <tiwai@suse.de>
3Date: Tue, 06 Feb 2007 19:12:11 +0100
4Subject: USB audio fixes 1
5To: stable@kernel.org
6Message-ID: <s5h3b5jw3yc.wl%tiwai@suse.de>
7
8From: Takashi Iwai <tiwai@suse.de>
9
10[PATCH] usbaudio - Fix Oops with broken usb descriptors
11
12This is a patch for ALSA Bug #2724. Some webcams provide bogus
13settings with no valid rates. With this patch those are skipped.
14
15Signed-off-by: Gregor Jasny <gjasny@web.de>
16Signed-off-by: Takashi Iwai <tiwai@suse.de>
17Signed-off-by: Jaroslav Kysela <perex@suse.cz>
18Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19
20---
21 sound/usb/usbaudio.c | 6 ++++++
22 1 file changed, 6 insertions(+)
23
24--- linux-2.6.20.1.orig/sound/usb/usbaudio.c
25+++ linux-2.6.20.1/sound/usb/usbaudio.c
26@@ -2456,6 +2456,7 @@ static int parse_audio_format_rates(stru
27 * build the rate table and bitmap flags
28 */
29 int r, idx, c;
30+ unsigned int nonzero_rates = 0;
31 /* this table corresponds to the SNDRV_PCM_RATE_XXX bit */
32 static unsigned int conv_rates[] = {
33 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000,
34@@ -2478,6 +2479,7 @@ static int parse_audio_format_rates(stru
35 fp->altsetting == 5 && fp->maxpacksize == 392)
36 rate = 96000;
37 fp->rate_table[r] = rate;
38+ nonzero_rates |= rate;
39 if (rate < fp->rate_min)
40 fp->rate_min = rate;
41 else if (rate > fp->rate_max)
42@@ -2493,6 +2495,10 @@ static int parse_audio_format_rates(stru
43 if (!found)
44 fp->needs_knot = 1;
45 }
46+ if (!nonzero_rates) {
47+ hwc_debug("All rates were zero. Skipping format!\n");
48+ return -1;
49+ }
50 if (fp->needs_knot)
51 fp->rates |= SNDRV_PCM_RATE_KNOT;
52 } else {