ALSA: usb-audio: fix feature unit parser for UAC2
authorDaniel Mack <[email protected]>
Thu, 27 May 2010 18:15:14 +0000 (20:15 +0200)
committerTakashi Iwai <[email protected]>
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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
sound/usb/mixer.c

index 97dd17655104a2bfbde0db95b6b6cab1c61d164f..03ce971e002760e84b2d36565ee0cbfa56bebd50 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;
        }