Skip to content

Commit 3da4b74

Browse files
Tom Rixtiwai
authored andcommitted
ALSA: usb-audio: initialize variables that could ignore errors
clang static analysis reports this representative issue mixer.c:1548:35: warning: Assigned value is garbage or undefined ucontrol->value.integer.value[0] = val; ^ ~~~ The filter_error() macro allows errors to be ignored. If errors can be ignored, initialize variables so garbage will not be used. Fixes: 48cc429 ("ALSA: usb-audio: Filter error from connector kctl ops, too") Signed-off-by: Tom Rix <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 549f8ff commit 3da4b74

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sound/usb/mixer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,10 @@ static int get_connector_value(struct usb_mixer_elem_info *cval,
15271527
usb_audio_err(chip,
15281528
"cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
15291529
UAC_GET_CUR, validx, idx, cval->val_type);
1530+
1531+
if (val)
1532+
*val = 0;
1533+
15301534
return filter_error(cval, ret);
15311535
}
15321536

0 commit comments

Comments
 (0)