[PATCH 13/36] ALSA: remove conditional return with no effect
From: Sang-Heon Jeon
Date: Thu Jul 23 2026 - 14:57:38 EST
Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.
This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.
Signed-off-by: Sang-Heon Jeon <ekffu200098@xxxxxxxxx>
---
sound/pci/echoaudio/echoaudio_dsp.c | 6 +-----
sound/pci/echoaudio/layla24_dsp.c | 6 +-----
sound/pci/riptide/riptide.c | 5 +----
sound/usb/mixer_scarlett.c | 26 ++++++++++----------------
4 files changed, 13 insertions(+), 30 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c
index 4dd494508c9b..90d7f364d2b3 100644
--- a/sound/pci/echoaudio/echoaudio_dsp.c
+++ b/sound/pci/echoaudio/echoaudio_dsp.c
@@ -496,11 +496,7 @@ static int load_firmware(struct echoaudio *chip)
if (err < 0)
return err;
- box_type = load_asic(chip);
- if (box_type < 0)
- return box_type; /* error */
-
- return box_type;
+ return load_asic(chip);
}
diff --git a/sound/pci/echoaudio/layla24_dsp.c b/sound/pci/echoaudio/layla24_dsp.c
index e7b8f5fe7753..6ed485acd618 100644
--- a/sound/pci/echoaudio/layla24_dsp.c
+++ b/sound/pci/echoaudio/layla24_dsp.c
@@ -54,11 +54,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
return err;
chip->bad_board = false;
- err = init_line_levels(chip);
- if (err < 0)
- return err;
-
- return err;
+ return init_line_levels(chip);
}
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 99c00e46ce23..fa9cbeb43f15 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1957,10 +1957,7 @@ static int snd_riptide_mixer(struct snd_riptide *chip)
chip->ac97_bus = pbus;
ac97.pci = chip->pci;
- err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
- if (err < 0)
- return err;
- return err;
+ return snd_ac97_mixer(pbus, &ac97, &chip->ac97);
}
#ifdef SUPPORT_JOYSTICK
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 673eb8d8724d..b500d6d45e66 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -1383,15 +1383,13 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer)
return err;
/* initialize sampling rate to 48000 */
- err = snd_usb_ctl_msg(mixer->chip->dev,
- usb_sndctrlpipe(mixer->chip->dev, 0), UAC2_CS_CUR,
- USB_RECIP_INTERFACE | USB_TYPE_CLASS |
- USB_DIR_OUT, 0x0100, snd_usb_ctrl_intf(mixer->hostif) |
- (0x29 << 8), sample_rate_buffer, 4);
- if (err < 0)
- return err;
-
- return err;
+ return snd_usb_ctl_msg(mixer->chip->dev,
+ usb_sndctrlpipe(mixer->chip->dev, 0),
+ UAC2_CS_CUR,
+ USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
+ 0x0100,
+ snd_usb_ctrl_intf(mixer->hostif) | (0x29 << 8),
+ sample_rate_buffer, 4);
}
/*
@@ -1446,11 +1444,7 @@ int snd_forte_controls_create(struct usb_mixer_interface *mixer)
}
/* val_len == 1 and UAC2_CS_MEM */
- err = add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2,
- USB_MIXER_U8, 1, "Sample Clock Sync Status",
- &opt_sync, &elem);
- if (err < 0)
- return err;
-
- return err;
+ return add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2,
+ USB_MIXER_U8, 1, "Sample Clock Sync Status",
+ &opt_sync, &elem);
}
--
2.43.0