[ALSA] fix selector unit bug affecting some USB speakerphones
authorRuss Cox <rsc@swtch.com>
Mon, 6 Aug 2007 13:37:58 +0000 (15:37 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:58:26 +0000 (15:58 +0200)
Following the suggestion in this thread:
https://bugs.launchpad.net/ubuntu/+source/alsa-lib/+bug/26683
the correct upper bound on desc[0] is 5 + num_ins not 6 + num_ins,
because the index used later is 5+i, not 6+i.
This change makes my Vosky Chatterbox speakerphone work.
Apparently it also helps with the Minivox MV100.

Signed-off-by: Russ Cox <rsc@swtch.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/usb/usbmixer.c

index 98d54483fec70e4f4141082854fe866e6223fef8..5e329690cfb1bbe6bb1fab91a36c7c5c1d6656ec 100644 (file)
@@ -1483,7 +1483,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsi
        struct snd_kcontrol *kctl;
        char **namelist;
 
-       if (! num_ins || desc[0] < 6 + num_ins) {
+       if (! num_ins || desc[0] < 5 + num_ins) {
                snd_printk(KERN_ERR "invalid SELECTOR UNIT descriptor %d\n", unitid);
                return -EINVAL;
        }