Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: gus: Fix kctl->id initialization

GUS driver replaces the kctl->id.index after assigning the kctl via
snd_ctl_add(). This doesn't work any longer with the new Xarray
lookup change. It has to be set before snd_ctl_add() call instead.

Fixes: c27e1efb61c5 ("ALSA: control: Use xarray for faster lookups")
Cc: <stable@vger.kernel.org>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230606093855.14685-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+1 -1
+1 -1
sound/isa/gus/gus_pcm.c
··· 892 892 kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control1, gus); 893 893 else 894 894 kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control, gus); 895 + kctl->id.index = control_index; 895 896 err = snd_ctl_add(card, kctl); 896 897 if (err < 0) 897 898 return err; 898 - kctl->id.index = control_index; 899 899 900 900 return 0; 901 901 }