diff options
author | Jonas Holmberg <jonashg@axis.com> | 2021-04-07 09:54:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-14 08:22:31 +0200 |
commit | c2566aad55cbafb94d033a0ebfc41c25cd0465a8 (patch) | |
tree | 04c47c4c18205a860675757a6be2cae1212633a2 /sound | |
parent | 830a059cbba6832c11fefc0894c7ec7a27f75734 (diff) | |
download | linux-stable-c2566aad55cbafb94d033a0ebfc41c25cd0465a8.tar.gz linux-stable-c2566aad55cbafb94d033a0ebfc41c25cd0465a8.tar.bz2 linux-stable-c2566aad55cbafb94d033a0ebfc41c25cd0465a8.zip |
ALSA: aloop: Fix initialization of controls
commit 168632a495f49f33a18c2d502fc249d7610375e9 upstream.
Add a control to the card before copying the id so that the numid field
is initialized in the copy. Otherwise the numid field of active_id,
format_id, rate_id and channels_id will be the same (0) and
snd_ctl_notify() will not queue the events properly.
Signed-off-by: Jonas Holmberg <jonashg@axis.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210407075428.2666787-1-jonashg@axis.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/drivers/aloop.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 1e34e6381baa..3c65e52b014c 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -1047,6 +1047,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) return -ENOMEM; kctl->id.device = dev; kctl->id.subdevice = substr; + + /* Add the control before copying the id so that + * the numid field of the id is set in the copy. + */ + err = snd_ctl_add(card, kctl); + if (err < 0) + return err; + switch (idx) { case ACTIVE_IDX: setup->active_id = kctl->id; @@ -1063,9 +1071,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) default: break; } - err = snd_ctl_add(card, kctl); - if (err < 0) - return err; } } } |