[PATCH 05/11] ALSA: caiaq: Register card at the final step

From: Takashi Iwai

Date: Thu Oct 08 2026 - 15:27:55 EST


caiaq driver calls snd_card_register() before creating the mixer
elements, which is rather confusing to user-space, as the devices have
been published before adding the control elements.

Swap the call order to make the card registration as the final step
(as written in the comment).

Fixes: 8e3cd08ed8e5 ("[ALSA] caiaq - add control API and more input features")
Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
sound/usb/caiaq/device.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index a596f5f763b8..c68ed16d7ac4 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -395,6 +395,12 @@ static int setup_card(struct snd_usb_caiaqdev *cdev)
return ret;
}

+ ret = snd_usb_caiaq_control_init(cdev);
+ if (ret < 0) {
+ dev_err(dev, "Unable to set up control system (ret=%d)\n", ret);
+ return ret;
+ }
+
/* finally, register the card and all its sub-instances */
ret = snd_card_register(cdev->chip.card);
if (ret < 0) {
@@ -402,12 +408,6 @@ static int setup_card(struct snd_usb_caiaqdev *cdev)
return ret;
}

- ret = snd_usb_caiaq_control_init(cdev);
- if (ret < 0) {
- dev_err(dev, "Unable to set up control system (ret=%d)\n", ret);
- return ret;
- }
-
return 0;
}

--
2.55.0