All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Jonas Holmberg <jonashg@axis.com>,
	tiwai@suse.de, alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: aloop: Fix initialization of controls
Date: Wed, 7 Apr 2021 10:01:41 +0200	[thread overview]
Message-ID: <78b5bd70-5bd0-8733-ce2e-247708278460@perex.cz> (raw)
In-Reply-To: <20210407075428.2666787-1-jonashg@axis.com>

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@axis.com>

Nice hit. Thanks.

Reviewed-by: Jaroslav Kysela <perex@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@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

  reply	other threads:[~2021-04-07  8:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  7:54 [PATCH] ALSA: aloop: Fix initialization of controls Jonas Holmberg
2021-04-07  8:01 ` Jaroslav Kysela [this message]
2021-04-07  8:22 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78b5bd70-5bd0-8733-ce2e-247708278460@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=jonashg@axis.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.