Commit 3884d12e authored by Jaejoong Kim's avatar Jaejoong Kim Committed by Greg Kroah-Hartman

ALSA: usb-audio: Add check return value for usb_string()

commit 89b89d12 upstream.

snd_usb_copy_string_desc() returns zero if usb_string() fails.
In case of failure, we need to check the snd_usb_copy_string_desc()'s
return value and add an exception case
Signed-off-by: default avatarJaejoong Kim <>
Signed-off-by: default avatarTakashi Iwai <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 3936d752
......@@ -2178,13 +2178,14 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
if (len)
else if (nameid)
snd_usb_copy_string_desc(state, nameid, kctl->,
len = snd_usb_copy_string_desc(state, nameid, kctl->,
else {
len = get_term_name(state, &state->oterm,
kctl->, sizeof(kctl->, 0);
if (!len)
strlcpy(kctl->, "USB", sizeof(kctl->;
if (!len) {
strlcpy(kctl->, "USB", sizeof(kctl->;
if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR)
append_ctl_name(kctl, " Clock Source");
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment