From: Takashi Iwai <tiwai@suse.de> Date: Fri, 19 Aug 2011 06:30:53 +0000 (+0200) Subject: ALSA: usb-audio - Check the dB-range validity in the later read, too X-Git-Tag: firefly_0821_release~7541^2~2292 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9338f407e30015cd9d236d8a678cacd2c72d4a31;p=firefly-linux-kernel-4.4.55.git ALSA: usb-audio - Check the dB-range validity in the later read, too commit 9fcd0ab130579d9742538340edda3225f2b49a3e upstream. When the initial check of dB-range failed due to the read error, try to check again at the later read, too. When an invalid dB range is found, remove TLV flags and notify the mixer info change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> --- diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index cdd19d7fe500..a033129e9733 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -881,8 +881,17 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ uinfo->value.integer.min = 0; uinfo->value.integer.max = 1; } else { - if (! cval->initialized) - get_min_max(cval, 0); + if (!cval->initialized) { + get_min_max(cval, 0); + if (cval->initialized && cval->dBmin >= cval->dBmax) { + kcontrol->vd[0].access &= + ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ | + SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK); + snd_ctl_notify(cval->mixer->chip->card, + SNDRV_CTL_EVENT_MASK_INFO, + &kcontrol->id); + } + } uinfo->value.integer.min = 0; uinfo->value.integer.max = (cval->max - cval->min + cval->res - 1) / cval->res;