Commit e49a14fa authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb: Avoid VLA in mixer_us16x08.c

This is another attempt to work around the VLA used in
mixer_us16x08.c.  Basically the temporary array is used individually
for two cases, and we can declare locally in each block, instead of
hackish max() usage.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 617163fc
......@@ -698,16 +698,18 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
struct snd_usb_audio *chip = elem->head.mixer->chip;
struct snd_us16x08_meter_store *store = elem->private_data;
u8 meter_urb[64];
char tmp[max(sizeof(mix_init_msg1), sizeof(mix_init_msg2))];
switch (kcontrol->private_value) {
case 0:
case 0: {
char tmp[sizeof(mix_init_msg1)];
memcpy(tmp, mix_init_msg1, sizeof(mix_init_msg1));
snd_us16x08_send_urb(chip, tmp, 4);
snd_us16x08_recv_urb(chip, meter_urb,
sizeof(meter_urb));
kcontrol->private_value++;
break;
}
case 1:
snd_us16x08_recv_urb(chip, meter_urb,
sizeof(meter_urb));
......@@ -718,7 +720,9 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
sizeof(meter_urb));
kcontrol->private_value++;
break;
case 3:
case 3: {
char tmp[sizeof(mix_init_msg2)];
memcpy(tmp, mix_init_msg2, sizeof(mix_init_msg2));
tmp[2] = snd_get_meter_comp_index(store);
snd_us16x08_send_urb(chip, tmp, 10);
......@@ -727,6 +731,7 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
kcontrol->private_value = 0;
break;
}
}
for (set = 0; set < 6; set++)
get_meter_levels_from_urb(set, store, meter_urb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment