summaryrefslogtreecommitdiff
path: root/sound/usb/clock.c
diff options
context:
space:
mode:
authorAndrew Chant <achant@google.com>2018-03-23 00:39:55 +0300
committerTakashi Iwai <tiwai@suse.de>2018-03-23 12:25:03 +0300
commit21e9b3e931f78497b19b1f8f3d59d19412c1a28f (patch)
treeceafcd8610b694895129a9d52da56672229ac791 /sound/usb/clock.c
parent9a2fe9b801f585baccf8352d82839dcd54b300cf (diff)
downloadlinux-21e9b3e931f78497b19b1f8f3d59d19412c1a28f.tar.xz
ALSA: usb-audio: fix uac control query argument
This patch fixes code readability and should have no functional change. Correct uac control query functions to account for the 1-based indexing of USB Audio Class control identifiers. The function parameter, u8 control, should be the constant defined in audio-v2.h to identify the control to be checked for readability or writeability. This patch fixes all callers that had adjusted, and makes explicit the mapping between audio_feature_info[] array index and the associated control identifier. Signed-off-by: Andrew Chant <achant@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/clock.c')
-rw-r--r--sound/usb/clock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 25de7fe285d9..ab39ccb974c6 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -214,7 +214,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip,
/* If a clock source can't tell us whether it's valid, we assume it is */
if (!uac_v2v3_control_is_readable(bmControls,
- UAC2_CS_CONTROL_CLOCK_VALID - 1))
+ UAC2_CS_CONTROL_CLOCK_VALID))
return 1;
err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
@@ -552,7 +552,8 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, int iface,
bmControls = cs_desc->bmControls;
}
- writeable = uac_v2v3_control_is_writeable(bmControls, UAC2_CS_CONTROL_SAM_FREQ - 1);
+ writeable = uac_v2v3_control_is_writeable(bmControls,
+ UAC2_CS_CONTROL_SAM_FREQ);
if (writeable) {
data = cpu_to_le32(rate);
err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,