ALSA: usb-audio - Call get_min_max_*() after determining the name string
get_min_max_with_quirks() must be called after the control id name string is determined, but the current code changes the id name string after calling the function. Reported-by: Christian Melki <christian.melki@ericsson.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -1141,9 +1141,6 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
|
|||||||
len = snd_usb_copy_string_desc(state, nameid,
|
len = snd_usb_copy_string_desc(state, nameid,
|
||||||
kctl->id.name, sizeof(kctl->id.name));
|
kctl->id.name, sizeof(kctl->id.name));
|
||||||
|
|
||||||
/* get min/max values */
|
|
||||||
get_min_max_with_quirks(cval, 0, kctl);
|
|
||||||
|
|
||||||
switch (control) {
|
switch (control) {
|
||||||
case UAC_FU_MUTE:
|
case UAC_FU_MUTE:
|
||||||
case UAC_FU_VOLUME:
|
case UAC_FU_VOLUME:
|
||||||
@@ -1175,6 +1172,17 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
|
|||||||
}
|
}
|
||||||
append_ctl_name(kctl, control == UAC_FU_MUTE ?
|
append_ctl_name(kctl, control == UAC_FU_MUTE ?
|
||||||
" Switch" : " Volume");
|
" Switch" : " Volume");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (! len)
|
||||||
|
strlcpy(kctl->id.name, audio_feature_info[control-1].name,
|
||||||
|
sizeof(kctl->id.name));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get min/max values */
|
||||||
|
get_min_max_with_quirks(cval, 0, kctl);
|
||||||
|
|
||||||
if (control == UAC_FU_VOLUME) {
|
if (control == UAC_FU_VOLUME) {
|
||||||
check_mapped_dB(map, cval);
|
check_mapped_dB(map, cval);
|
||||||
if (cval->dBmin < cval->dBmax || !cval->initialized) {
|
if (cval->dBmin < cval->dBmax || !cval->initialized) {
|
||||||
@@ -1184,14 +1192,6 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
|
|||||||
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
|
SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (! len)
|
|
||||||
strlcpy(kctl->id.name, audio_feature_info[control-1].name,
|
|
||||||
sizeof(kctl->id.name));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
range = (cval->max - cval->min) / cval->res;
|
range = (cval->max - cval->min) / cval->res;
|
||||||
/* Are there devices with volume range more than 255? I use a bit more
|
/* Are there devices with volume range more than 255? I use a bit more
|
||||||
|
Reference in New Issue
Block a user