Skip to content

Commit

Permalink
ALSA: snd-usb: fix clock source validity index
Browse files Browse the repository at this point in the history
uac_clock_source_is_valid() uses the control selector value to access
the bmControls bitmap of the clock source unit. This is wrong, as
control selector values start from 1, while the bitmap uses all
available bits.

In other words, "Clock Validity Control" is stored in D3..2, not D5..4
of the clock selector unit's bmControls.

Signed-off-by: Daniel Mack <[email protected]>
Reported-by: Andreas Koch <[email protected]>
Cc: [email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
zonque authored and tiwai committed Aug 1, 2012
1 parent 1f43f6c commit aff252a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/usb/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
return 0;

/* If a clock source can't tell us whether it's valid, we assume it is */
if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
if (!uac2_control_is_readable(cs_desc->bmControls,
UAC2_CS_CONTROL_CLOCK_VALID - 1))
return 1;

err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
Expand Down

0 comments on commit aff252a

Please sign in to comment.