]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: usb-audio: fix broken logic in snd_audigy2nx_led_update()
authorSergey Shtylyov <s.shtylyov@auroraos.dev>
Tue, 3 Feb 2026 16:15:57 +0000 (19:15 +0300)
committerTakashi Iwai <tiwai@suse.de>
Tue, 3 Feb 2026 17:13:46 +0000 (18:13 +0100)
When the support for the Sound Blaster X-Fi Surround 5.1 Pro was added,
the existing logic for the X-Fi Surround 5.1 in snd_audigy2nx_led_put()
was broken due to missing *else* before the added *if*: snd_usb_ctl_msg()
became incorrectly called twice and an error from first snd_usb_ctl_msg()
call ignored.  As the added snd_usb_ctl_msg() call was totally identical
to the existing one for the "plain" X-Fi Surround 5.1, just merge those
two *if* statements while fixing the broken logic...

Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.

Fixes: 7cdd8d73139e ("ALSA: usb-audio - Add support for USB X-Fi S51 Pro")
Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>
Link: https://patch.msgid.link/20260203161558.18680-1-s.shtylyov@auroraos.dev
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer_quirks.c

index f8eccb1c58da12e5a521cf4da6b4fb2094c6cccc..cf4ccf467cb652357e486ed23625b67c51769ced 100644 (file)
@@ -311,13 +311,8 @@ static int snd_audigy2nx_led_update(struct usb_mixer_interface *mixer,
        if (pm.err < 0)
                return pm.err;
 
-       if (chip->usb_id == USB_ID(0x041e, 0x3042))
-               err = snd_usb_ctl_msg(chip->dev,
-                                     usb_sndctrlpipe(chip->dev, 0), 0x24,
-                                     USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
-                                     !value, 0, NULL, 0);
-       /* USB X-Fi S51 Pro */
-       if (chip->usb_id == USB_ID(0x041e, 0x30df))
+       if (chip->usb_id == USB_ID(0x041e, 0x3042) ||   /* USB X-Fi S51 */
+           chip->usb_id == USB_ID(0x041e, 0x30df))     /* USB X-Fi S51 Pro */
                err = snd_usb_ctl_msg(chip->dev,
                                      usb_sndctrlpipe(chip->dev, 0), 0x24,
                                      USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,