提交 168632a4 编写于 作者: J Jonas Holmberg 提交者: Takashi Iwai

ALSA: aloop: Fix initialization of controls

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: NJonas Holmberg <jonashg@axis.com>
Reviewed-by: NJaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210407075428.2666787-1-jonashg@axis.comSigned-off-by: NTakashi Iwai <tiwai@suse.de>
上级 c6423ed2
...@@ -1572,6 +1572,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) ...@@ -1572,6 +1572,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
return -ENOMEM; return -ENOMEM;
kctl->id.device = dev; kctl->id.device = dev;
kctl->id.subdevice = substr; 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) { switch (idx) {
case ACTIVE_IDX: case ACTIVE_IDX:
setup->active_id = kctl->id; setup->active_id = kctl->id;
...@@ -1588,9 +1596,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify) ...@@ -1588,9 +1596,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
default: default:
break; break;
} }
err = snd_ctl_add(card, kctl);
if (err < 0)
return err;
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册