sound/usb/mixer_scarlett2.c | 2 ++ 1 file changed, 2 insertions(+)
When initialise new control with scarlett2_add_new_ctl() function for
Autogain Status, scarlett2_add_new_ctl() might throw an error. So, add
error check after initialise new control for Autogain Status.
This is reported by Coverity Scan with CID 1598781 as UNUSED_VALUE.
Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
Signed-off-by: Robertus Diawan Chris <robertusdchris@gmail.com>
---
I don't have the device myself, so I can't test this change. Thank you.
sound/usb/mixer_scarlett2.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 8eaa96222759..0f83f8981213 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -6707,6 +6707,8 @@ static int scarlett2_add_line_in_ctls(struct usb_mixer_interface *mixer)
err = scarlett2_add_new_ctl(
mixer, &scarlett2_autogain_status_ctl,
i, 1, s, &private->autogain_status_ctls[i]);
+ if (err < 0)
+ return err;
}
/* Add autogain target controls */
base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
--
2.54.0
On Fri, 08 May 2026 05:39:14 +0200,
Robertus Diawan Chris wrote:
>
> When initialise new control with scarlett2_add_new_ctl() function for
> Autogain Status, scarlett2_add_new_ctl() might throw an error. So, add
> error check after initialise new control for Autogain Status.
>
> This is reported by Coverity Scan with CID 1598781 as UNUSED_VALUE.
>
> Fixes: 0a995e38dc44 ("ALSA: scarlett2: Add support for software-controllable input gain")
> Signed-off-by: Robertus Diawan Chris <robertusdchris@gmail.com>
Applied now. Thanks.
Takashi
© 2016 - 2026 Red Hat, Inc.