public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Avoid false E-MU sample-rate notifications
@ 2026-04-22  0:53 Cássio Gabriel
  2026-04-22 15:52 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Cássio Gabriel @ 2026-04-22  0:53 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Jaroslav Kysela, Sergiy Kovalchuk, linux-sound, linux-kernel,
	stable, Cássio Gabriel

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: 7d2b451e65d2 ("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>
---
 sound/usb/mixer_quirks.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index a01510a855c2..5194a2ac1ea8 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1538,15 +1538,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
 {
 	struct usb_mixer_interface *mixer;
 	struct usb_mixer_elem_info *cval;
+	int err;
 	int unitid = 12; /* SampleRate ExtensionUnit ID */
 
 	list_for_each_entry(mixer, &chip->mixer_list, list) {
 		if (mixer->id_elems[unitid]) {
 			cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
-			snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
-						    cval->control << 8,
-						    samplerate_id);
-			snd_usb_mixer_notify_id(mixer, unitid);
+			err = snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
+							  cval->control << 8,
+							  samplerate_id);
+			if (!err)
+				snd_usb_mixer_notify_id(mixer, unitid);
 			break;
 		}
 	}

---
base-commit: d60c26089541d574b854d7762e9f3c182a76ad9d
change-id: 20260417-alsa-emuusb-samplerate-notify-9fd83d5c36b5

Best regards,
--  
Cássio Gabriel <cassiogabrielcontato@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: usb-audio: Avoid false E-MU sample-rate notifications
  2026-04-22  0:53 [PATCH] ALSA: usb-audio: Avoid false E-MU sample-rate notifications Cássio Gabriel
@ 2026-04-22 15:52 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-04-22 15:52 UTC (permalink / raw)
  To: Cássio Gabriel
  Cc: Takashi Iwai, Jaroslav Kysela, Sergiy Kovalchuk, linux-sound,
	linux-kernel, stable

On Wed, 22 Apr 2026 02:53:52 +0200,
Cássio Gabriel wrote:
> 
> 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: 7d2b451e65d2 ("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>

Thanks, applied now.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-22 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22  0:53 [PATCH] ALSA: usb-audio: Avoid false E-MU sample-rate notifications Cássio Gabriel
2026-04-22 15:52 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox