diff options
author | Tom Yan <tom.ty89@gmail.com> | 2020-08-17 20:20:11 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-08-17 20:58:29 +0300 |
commit | d8d0db7bb358ef65d60726a61bfcd08eccff0bc0 (patch) | |
tree | df7ff6a76be2aabc273a927d9359da1f77a58579 /sound/usb/mixer.c | |
parent | 23dc958689449be85e39351a8c809c3d344b155b (diff) | |
download | linux-d8d0db7bb358ef65d60726a61bfcd08eccff0bc0.tar.xz |
ALSA: usb-audio: ignore broken processing/extension unit
Some devices have broken extension unit where getting current value
doesn't work. Attempt that once when creating mixer control for it. If
it fails, just ignore it, so that it won't cripple the device entirely
(and/or make the error floods).
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
Link: https://lore.kernel.org/r/5f3abc52.1c69fb81.9cf2.fe91@mx.google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r-- | sound/usb/mixer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 6b0f3a8469ef..81e987eaf063 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -2371,7 +2371,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, int num_ins; struct usb_mixer_elem_info *cval; struct snd_kcontrol *kctl; - int i, err, nameid, type, len; + int i, err, nameid, type, len, val; const struct procunit_info *info; const struct procunit_value_info *valinfo; const struct usbmix_name_map *map; @@ -2474,6 +2474,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, break; } + err = get_cur_ctl_value(cval, cval->control << 8, &val); + if (err < 0) { + usb_mixer_elem_info_free(cval); + return -EINVAL; + } + kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); if (!kctl) { usb_mixer_elem_info_free(cval); |