]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: usb-audio: Propagate errors in scarlett_ctl_enum_put()
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Sun, 19 Apr 2026 20:30:30 +0000 (17:30 -0300)
committerTakashi Iwai <tiwai@suse.de>
Mon, 27 Apr 2026 11:44:48 +0000 (13:44 +0200)
scarlett_ctl_enum_put() ignores the return value from
snd_usb_set_cur_mix_value() and reports success whenever the
requested enum value differs from the current one.

If the SET_CUR request fails, the callback still returns success even
though neither the hardware state nor the cached mixer value changed.

Fixes: 76b188c4b370 ("ALSA: usb-audio: Scarlett mixer interface for 6i6, 18i6, 18i8 and 18i20")
Cc: stable@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260419-usb-write-error-propagation-v1-2-5a3bd4a673ae@gmail.com
sound/usb/mixer_scarlett.c

index 1bb01e8276549a938e08c2be10f815f2678633fa..673eb8d8724dbce2d6e1fc47f7fbbf18d72c5b32 100644 (file)
@@ -680,7 +680,9 @@ static int scarlett_ctl_enum_put(struct snd_kcontrol *kctl,
        val = ucontrol->value.integer.value[0];
        val = val + opt->start;
        if (val != oval) {
-               snd_usb_set_cur_mix_value(elem, 0, 0, val);
+               err = snd_usb_set_cur_mix_value(elem, 0, 0, val);
+               if (err < 0)
+                       return err;
                return 1;
        }
        return 0;