Skip to content

Commit 610ba60

Browse files
CassivsGabriellisgregkh
authored andcommitted
ALSA: usb-audio: Avoid false E-MU sample-rate notifications
commit fca9c85 upstream. snd_emuusb_set_samplerate() unconditionally notifies the E-MU SampleRate Extension Unit control after issuing SET_CUR. If snd_usb_mixer_set_ctl_value() fails, the control value has not changed, yet snd_usb_mixer_notify_id() still invalidates the cache and emits a value-change event to userspace. Notify the control only after a successful write. Fixes: 7d2b451 ("ALSA: usb-audio - Added functionality for E-mu 0404USB/0202USB/TrackerPre") Cc: stable@vger.kernel.org Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com> Link: https://patch.msgid.link/20260421-alsa-emuusb-samplerate-notify-v1-1-8b63bbc1d7f1@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ab5ba9f commit 610ba60

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

sound/usb/mixer_quirks.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,15 +1561,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
15611561
{
15621562
struct usb_mixer_interface *mixer;
15631563
struct usb_mixer_elem_info *cval;
1564+
int err;
15641565
int unitid = 12; /* SampleRate ExtensionUnit ID */
15651566

15661567
list_for_each_entry(mixer, &chip->mixer_list, list) {
15671568
if (mixer->id_elems[unitid]) {
15681569
cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
1569-
snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
1570-
cval->control << 8,
1571-
samplerate_id);
1572-
snd_usb_mixer_notify_id(mixer, unitid);
1570+
err = snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
1571+
cval->control << 8,
1572+
samplerate_id);
1573+
if (!err)
1574+
snd_usb_mixer_notify_id(mixer, unitid);
15731575
break;
15741576
}
15751577
}

0 commit comments

Comments
 (0)