summaryrefslogtreecommitdiff
path: root/sound/usb
diff options
context:
space:
mode:
authorNathan Chancellor <nathan@kernel.org>2024-04-20 03:25:59 +0300
committerTakashi Iwai <tiwai@suse.de>2024-04-21 20:30:53 +0300
commit3a56855bb549211031184e45fe1a9d24874d7227 (patch)
tree0596f47b15e6557eefdc3eaa0f8abb95611acdde /sound/usb
parent32cb23a0f911317cdb5030035e49a204aa86fef5 (diff)
downloadlinux-3a56855bb549211031184e45fe1a9d24874d7227.tar.xz
ALSA: scarlett2: Zero initialize ret in scarlett2_ag_target_ctl_get()
Clang warns (or errors with CONFIG_WERROR): sound/usb/mixer_scarlett2.c:3697:6: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] 3697 | if (private->autogain_updated) { | ^~~~~~~~~~~~~~~~~~~~~~~~~ sound/usb/mixer_scarlett2.c:3707:9: note: uninitialized use occurs here 3707 | return err; | ^~~ sound/usb/mixer_scarlett2.c:3697:2: note: remove the 'if' if its condition is always true 3697 | if (private->autogain_updated) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/usb/mixer_scarlett2.c:3688:9: note: initialize the variable 'err' to silence this warning 3688 | int err; | ^ | = 0 1 error generated. Initialize ret to zero to ensure ret is initialized in all paths within scarlett2_ag_target_ctl_get(), which matches the style of other functions in this driver. Fixes: e30ea5340c25 ("ALSA: scarlett2: Add autogain target controls") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Message-ID: <20240419-alsa-scarlett2-fix-wsometimes-uninitialized-v1-1-e2ace8642e08@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/mixer_scarlett2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index a2de31a0371b..b251d25f2a85 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -3685,7 +3685,7 @@ static int scarlett2_ag_target_ctl_get(
struct usb_mixer_elem_info *elem = kctl->private_data;
struct usb_mixer_interface *mixer = elem->head.mixer;
struct scarlett2_data *private = mixer->private_data;
- int err;
+ int err = 0;
mutex_lock(&private->data_mutex);