aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-05-14 11:11:06 -0400
committerTakashi Iwai <tiwai@suse.de>2012-05-15 02:35:00 -0400
commite182534d4bd3a779941f2868f35e1f66a8d36cea (patch)
tree9215ad0124e637a4dbc76a1e759e1aaed6673a6a /sound
parentf3af90517d87bf8f4b21c2e68c8a15d9b7fd516e (diff)
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/mixer.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 3d70245ab442..4f40ba823163 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1141,9 +1141,6 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1141 len = snd_usb_copy_string_desc(state, nameid, 1141 len = snd_usb_copy_string_desc(state, nameid,
1142 kctl->id.name, sizeof(kctl->id.name)); 1142 kctl->id.name, sizeof(kctl->id.name));
1143 1143
1144 /* get min/max values */
1145 get_min_max_with_quirks(cval, 0, kctl);
1146
1147 switch (control) { 1144 switch (control) {
1148 case UAC_FU_MUTE: 1145 case UAC_FU_MUTE:
1149 case UAC_FU_VOLUME: 1146 case UAC_FU_VOLUME:
@@ -1175,17 +1172,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1175 } 1172 }
1176 append_ctl_name(kctl, control == UAC_FU_MUTE ? 1173 append_ctl_name(kctl, control == UAC_FU_MUTE ?
1177 " Switch" : " Volume"); 1174 " Switch" : " Volume");
1178 if (control == UAC_FU_VOLUME) {
1179 check_mapped_dB(map, cval);
1180 if (cval->dBmin < cval->dBmax || !cval->initialized) {
1181 kctl->tlv.c = snd_usb_mixer_vol_tlv;
1182 kctl->vd[0].access |=
1183 SNDRV_CTL_ELEM_ACCESS_TLV_READ |
1184 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
1185 }
1186 }
1187 break; 1175 break;
1188
1189 default: 1176 default:
1190 if (! len) 1177 if (! len)
1191 strlcpy(kctl->id.name, audio_feature_info[control-1].name, 1178 strlcpy(kctl->id.name, audio_feature_info[control-1].name,
@@ -1193,6 +1180,19 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1193 break; 1180 break;
1194 } 1181 }
1195 1182
1183 /* get min/max values */
1184 get_min_max_with_quirks(cval, 0, kctl);
1185
1186 if (control == UAC_FU_VOLUME) {
1187 check_mapped_dB(map, cval);
1188 if (cval->dBmin < cval->dBmax || !cval->initialized) {
1189 kctl->tlv.c = snd_usb_mixer_vol_tlv;
1190 kctl->vd[0].access |=
1191 SNDRV_CTL_ELEM_ACCESS_TLV_READ |
1192 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
1193 }
1194 }
1195
1196 range = (cval->max - cval->min) / cval->res; 1196 range = (cval->max - cval->min) / cval->res;
1197 /* Are there devices with volume range more than 255? I use a bit more 1197 /* Are there devices with volume range more than 255? I use a bit more
1198 * to be sure. 384 is a resolution magic number found on Logitech 1198 * to be sure. 384 is a resolution magic number found on Logitech