ALSA: usb-audio: fix feature unit parser for UAC2
authorDaniel Mack <daniel@caiaq.de>
Thu, 27 May 2010 18:15:14 +0000 (20:15 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 28 May 2010 05:48:17 +0000 (07:48 +0200)
Fix a small off-by-one bug which causes the feature unit to announce a
wrong number of channels. This leads to illegal requests sent to the
firmware eventually.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c

index 97dd176..03ce971 100644 (file)
@@ -1126,7 +1126,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
        } else {
                struct uac2_feature_unit_descriptor *ftr = _ftr;
                csize = 4;
-               channels = (hdr->bLength - 6) / 4;
+               channels = (hdr->bLength - 6) / 4 - 1;
                bmaControls = ftr->bmaControls;
        }