Skip to content

Commit 971cb60

Browse files
committed
ALSA: usb-audio: Yet more regression for for the delayed card registration
Although we tried to fix the regression for the recent changes with the delayed card registration, it doesn't seem covering the all cases; e.g. on Roland EDIROL M-100FX, where the generic quirk for Roland devices is applied, it misses the card registration because the detection of the last interface (apparently for MIDI) fails. This patch is an attempt to recover from those failures by calling the card register also at the error path for the secondary interfaces. The card register condition is also extended to match with the old check in the previous patch, too (i.e. the simple check of the interface number) for catching the probe with errors. Fixes: 39efc9c ("ALSA: usb-audio: Fix last interface check for registration") Cc: <[email protected]> Link: https://bugzilla.suse.com/show_bug.cgi?id=1205111 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 0c423e2 commit 971cb60

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

sound/usb/card.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,18 @@ get_alias_quirk(struct usb_device *dev, unsigned int id)
742742
return NULL;
743743
}
744744

745+
/* register card if we reach to the last interface or to the specified
746+
* one given via option
747+
*/
748+
static int try_to_register_card(struct snd_usb_audio *chip, int ifnum)
749+
{
750+
if (check_delayed_register_option(chip) == ifnum ||
751+
chip->last_iface == ifnum ||
752+
usb_interface_claimed(usb_ifnum_to_if(chip->dev, chip->last_iface)))
753+
return snd_card_register(chip->card);
754+
return 0;
755+
}
756+
745757
/*
746758
* probe the active usb device
747759
*
@@ -880,15 +892,9 @@ static int usb_audio_probe(struct usb_interface *intf,
880892
chip->need_delayed_register = false; /* clear again */
881893
}
882894

883-
/* register card if we reach to the last interface or to the specified
884-
* one given via option
885-
*/
886-
if (check_delayed_register_option(chip) == ifnum ||
887-
usb_interface_claimed(usb_ifnum_to_if(dev, chip->last_iface))) {
888-
err = snd_card_register(chip->card);
889-
if (err < 0)
890-
goto __error;
891-
}
895+
err = try_to_register_card(chip, ifnum);
896+
if (err < 0)
897+
goto __error_no_register;
892898

893899
if (chip->quirk_flags & QUIRK_FLAG_SHARE_MEDIA_DEVICE) {
894900
/* don't want to fail when snd_media_device_create() fails */
@@ -907,6 +913,11 @@ static int usb_audio_probe(struct usb_interface *intf,
907913
return 0;
908914

909915
__error:
916+
/* in the case of error in secondary interface, still try to register */
917+
if (chip)
918+
try_to_register_card(chip, ifnum);
919+
920+
__error_no_register:
910921
if (chip) {
911922
/* chip->active is inside the chip->card object,
912923
* decrement before memory is possibly returned.

0 commit comments

Comments
 (0)