ALSA: aloop: Fix initialization of controls
PATCH 1/1 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.
--- sound/drivers/aloop.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
sound/drivers/aloop.c +8 -3
@@ -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; } } }
Signature · 1 line
2.26.3
Dne 07. 04. 21 v 9:54 Jonas Holmberg napsal(a):
Quoted 6 lines
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_idandchannels_idwill be the same (0) andsnd_ctl_notify()will not queue the events properly.Signed-off-by Jonas Holmberg <[email protected]>
Nice hit. Thanks.
Quoted 34 lines
--- sound/drivers/aloop.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)sound/drivers/aloop.c +8
-3@@ -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; } } }
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Quoted 7 lines · Jonas Holmberg
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_idandchannels_idwill be the same (0) andsnd_ctl_notify()will not queue the events properly.Signed-off-by Jonas Holmberg <[email protected]>
Applied now (with Cc to stable).
thanks,
Takashi
Quoted 36 lines
--- sound/drivers/aloop.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)sound/drivers/aloop.c +8
-3@@ -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; } } }Signature · 1 line
2.26.3