Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH RFT] ALSA: scarlett2: Add missing error check when initialise Autogain Status
@ 2026-05-08  3:39 Robertus Diawan Chris
  0 siblings, 0 replies; only message in thread
From: Robertus Diawan Chris @ 2026-05-08  3:39 UTC (permalink / raw)
  To: g, perex, tiwai
  Cc: linux-sound, linux-kernel, linux-kernel-mentees, skhan, me

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-08  3:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08  3:39 [PATCH RFT] ALSA: scarlett2: Add missing error check when initialise Autogain Status Robertus Diawan Chris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox