Re: [PATCH] ALSA: aloop: Fix initialization of controls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>

Nice hit. Thanks.

Reviewed-by: Jaroslav Kysela <perex@xxxxxxxx>

> ---
>  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@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux