[PATCH] ALSA: aloop: Fix initialization of controls
Jaroslav Kysela
perex at perex.cz
Wed Apr 7 10:01:41 CEST 2021
Dne 07. 04. 21 v 9:54 Jonas Holmberg napsal(a):
> 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 at axis.com>
Nice hit. Thanks.
Reviewed-by: Jaroslav Kysela <perex at perex.cz>
> ---
> sound/drivers/aloop.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
> index 52637180af33..80b814b9922a 100644
> --- a/sound/drivers/aloop.c
> +++ b/sound/drivers/aloop.c
> @@ -1571,6 +1571,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;
> @@ -1587,9 +1595,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
> default:
> break;
> }
> - err = snd_ctl_add(card, kctl);
> - if (err < 0)
> - return err;
> }
> }
> }
>
--
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
More information about the Alsa-devel
mailing list