Skip to content

Commit ae0aad8

Browse files
Sergey Shtylyovgregkh
authored andcommitted
ALSA: usb-audio: fix broken logic in snd_audigy2nx_led_update()
[ Upstream commit 124bdc6 ] 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: 7cdd8d7 ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d8143c5 commit ae0aad8

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

sound/usb/mixer_quirks.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,8 @@ static int snd_audigy2nx_led_update(struct usb_mixer_interface *mixer,
310310
if (err < 0)
311311
return err;
312312

313-
if (chip->usb_id == USB_ID(0x041e, 0x3042))
314-
err = snd_usb_ctl_msg(chip->dev,
315-
usb_sndctrlpipe(chip->dev, 0), 0x24,
316-
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
317-
!value, 0, NULL, 0);
318-
/* USB X-Fi S51 Pro */
319-
if (chip->usb_id == USB_ID(0x041e, 0x30df))
313+
if (chip->usb_id == USB_ID(0x041e, 0x3042) || /* USB X-Fi S51 */
314+
chip->usb_id == USB_ID(0x041e, 0x30df)) /* USB X-Fi S51 Pro */
320315
err = snd_usb_ctl_msg(chip->dev,
321316
usb_sndctrlpipe(chip->dev, 0), 0x24,
322317
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,

0 commit comments

Comments
 (0)