public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Fix missing error handling for get_min_max*()
@ 2026-04-14  9:33 Takashi Iwai
  2026-04-14 12:17 ` Rong Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2026-04-14  9:33 UTC (permalink / raw)
  To: linux-sound; +Cc: Dan Carpenter, Rong Zhang

The recent fix to add the error return value check from get_min_max*()
missed one case in build_audio_procunit() where no error value is set.
This may lead to an uninitialized variable and confuse the caller
(although this wouldn't happen practically because err is set for the
loop of num_ins at the beginning of the funciton).

Fix it by setting "err = 0" properly at the missing case, too.

Fixes: 4f55a85cd4fc ("ALSA: usb-audio: Add error checks against get_min_max*()")
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/ad36dGpCBTGsyFr_@stanley.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/mixer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index d4ef45bf53d7..aa6ea3be100a 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2687,6 +2687,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
 				cval->max = control_spec[0];
 				cval->res = 1;
 				cval->initialized = 1;
+				err = 0;
 				break;
 			}
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-14 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14  9:33 [PATCH] ALSA: usb-audio: Fix missing error handling for get_min_max*() Takashi Iwai
2026-04-14 12:17 ` Rong Zhang
2026-04-14 12:46   ` Takashi Iwai

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