diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-06-22 20:00:49 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-06-22 22:39:19 +0300 |
commit | 785b6f29a795f109685f286b91e0250c206fbffb (patch) | |
tree | e1780e838c22ded40604785c18baf423e1fd9fc4 /sound/usb/mixer.c | |
parent | b126bbac98d4ce4f6e78604027c60f536893eb78 (diff) | |
download | linux-785b6f29a795f109685f286b91e0250c206fbffb.tar.xz |
ALSA: usb-audio: scarlett2: Fix wrong resume call
The current way of the scarlett2 mixer code managing the
usb_mixer_elem_info object is wrong in two ways: it passes its
internal index to the head.id field, and the val_type field is
uninitialized. This ended up with the wrong execution at the resume
because a bogus unit id is passed wrongly. Also, in the later code
extensions, we'll have more mixer elements, and passing the index will
overflow the unit id size (of 256).
This patch corrects those issues. It introduces a new value type,
USB_MIXER_BESPOKEN, which indicates a non-standard mixer element, and
use this type for all scarlett2 mixer elements, as well as
initializing the fixed unit id 0 for avoiding the overflow.
Tested-by: Geoffrey D. Bennett <g@b4.vu>
Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/49721219f45b7e175e729b0d9d9c142fd8f4342a.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r-- | sound/usb/mixer.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 4ea4875abdf8..30b3e128e28d 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -3606,6 +3606,9 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list) struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list); int c, err, idx; + if (cval->val_type == USB_MIXER_BESPOKEN) + return 0; + if (cval->cmask) { idx = 0; for (c = 0; c < MAX_CHANNELS; c++) { |