Skip to content

Commit 168632a

Browse files
Jonas Holmbergtiwai
authored andcommitted
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: Jonas Holmberg <[email protected]> Reviewed-by: Jaroslav Kysela <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent c6423ed commit 168632a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sound/drivers/aloop.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
15721572
return -ENOMEM;
15731573
kctl->id.device = dev;
15741574
kctl->id.subdevice = substr;
1575+
1576+
/* Add the control before copying the id so that
1577+
* the numid field of the id is set in the copy.
1578+
*/
1579+
err = snd_ctl_add(card, kctl);
1580+
if (err < 0)
1581+
return err;
1582+
15751583
switch (idx) {
15761584
case ACTIVE_IDX:
15771585
setup->active_id = kctl->id;
@@ -1588,9 +1596,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
15881596
default:
15891597
break;
15901598
}
1591-
err = snd_ctl_add(card, kctl);
1592-
if (err < 0)
1593-
return err;
15941599
}
15951600
}
15961601
}

0 commit comments

Comments
 (0)