Skip to contentSkip to conversation

ALSA: usb-audio: correct the value cache check.

PATCH In review Yao-Wen Mao 2 participants 2 messages Aug 28, 2015 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: usb-audio: correct the value cache check.

The check of cval->cached should be zero-based (including master channel).

---
 sound/usb/mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer.c +1 -1
index fd5c49e..f494dce 100644
@@ -2540,7 +2540,7 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list)
 		for (c = 0; c < MAX_CHANNELS; c++) {
 			if (!(cval->cmask & (1 << c)))
 				continue;
-			if (cval->cached & (1 << c)) {
+			if (cval->cached & (1 << (c + 1))) {
 				err = snd_usb_set_cur_mix_value(cval, c + 1, idx,
 							cval->cache_val[idx]);
 				if (err < 0)
Signature · 1 line
2.5.0.457.gab17608
#1 lore raw
Quoted 4 lines · Yao-Wen Mao

The check of cval->cached should be zero-based (including master channel).

A good catch. Applied now, thanks.

Takashi

Quoted 21 lines
---
 sound/usb/mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer.c +1 -1
index fd5c49e..f494dce 100644
@@ -2540,7 +2540,7 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list)
 		for (c = 0; c < MAX_CHANNELS; c++) {
 			if (!(cval->cmask & (1 << c)))
 				continue;
-			if (cval->cached & (1 << c)) {
+			if (cval->cached & (1 << (c + 1))) {
 				err = snd_usb_set_cur_mix_value(cval, c + 1, idx,
 							cval->cache_val[idx]);
 				if (err < 0)
Signature · 1 line
2.5.0.457.gab17608