ALSA: usb-audio: scarlett2: Fix wrong resume call
authorTakashi Iwai <tiwai@suse.de>
Tue, 22 Jun 2021 17:00:49 +0000 (02:30 +0930)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:55:35 +0000 (16:55 +0200)
commit19418ed317cac8b317faa36baa2e2d3418f4f7e7
tree27745c1f984bb905b5462c43a9485bd001f4201f
parent5c4d51b438f3cece486a5a8983bc981862e9afae
ALSA: usb-audio: scarlett2: Fix wrong resume call

commit 785b6f29a795f109685f286b91e0250c206fbffb upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/mixer.c
sound/usb/mixer.h
sound/usb/mixer_scarlett_gen2.c