Skip to contentSkip to conversation

ALSA: scarlett2: Add missing error check when initialise Autogain Status

PATCH In review Robertus Diawan Chris 2 participants 2 messages May 8 – May 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: scarlett2: Add missing error check when initialise Autogain Status

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")

---
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(+)
sound/usb/mixer_scarlett2.c +2 -0
index 8eaa96222759..0f83f8981213 100644
@@ -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

Signature · 1 line
2.54.0
#1 lore raw
Quoted 9 lines · Robertus Diawan Chris

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")

Applied now. Thanks.

Takashi