snd_uaudio(4): Fix string index computations for iFeature.

This allows the iFeature strings to be properly read by the snd_uaudio(4) driver,
when parsing the audio feature unit descriptors.

Submitted by:	Zhichao1.Li@dell.com
MFC after:	1 week
Sponsored by:	NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2021-11-09 22:07:36 +01:00
parent 0752d078df
commit 11f09b17fe

View file

@ -3648,18 +3648,18 @@ uaudio_mixer_add_feature(struct uaudio_softc *sc,
cmask |= uaudio_mixer_feature_get_bmaControls(d, chan);
}
if (nchan > MIX_MAX_CHAN)
nchan = MIX_MAX_CHAN;
MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no);
i = d->bmaControls[d->bControlSize];
i = d->bmaControls[nchan * d->bControlSize];
if (i == 0 ||
usbd_req_get_string_any(sc->sc_udev, NULL,
MIX(sc).desc, sizeof(MIX(sc).desc), i) != 0) {
MIX(sc).desc[0] = 0;
}
if (nchan > MIX_MAX_CHAN)
nchan = MIX_MAX_CHAN;
for (ctl = 1; ctl <= LOUDNESS_CONTROL; ctl++) {
fumask = FU_MASK(ctl);
@ -3782,9 +3782,6 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc,
for (chan = 1; chan < nchan; chan++)
cmask |= UGETDW(d->bmaControls[chan]);
if (nchan > MIX_MAX_CHAN)
nchan = MIX_MAX_CHAN;
MIX(sc).wIndex = MAKE_WORD(d->bUnitId, sc->sc_mixer_iface_no);
i = d->bmaControls[nchan][0];
@ -3794,6 +3791,9 @@ uaudio20_mixer_add_feature(struct uaudio_softc *sc,
MIX(sc).desc[0] = 0;
}
if (nchan > MIX_MAX_CHAN)
nchan = MIX_MAX_CHAN;
for (ctl = 3; ctl != 0; ctl <<= 2) {
mixernumber = uaudio20_mixer_determine_class(&iot[id]);