]> err.no Git - linux-2.6/commitdiff
[ALSA] Fix the race of card instance unregistration
authorTakashi Iwai <tiwai@suse.de>
Thu, 17 Apr 2008 10:50:47 +0000 (12:50 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 24 Apr 2008 10:00:39 +0000 (12:00 +0200)
Move the call of device_unregister() for the card instance in
snd_card_disconnect() to avoid the race of sysfs card entry, which
can be typically found on usb-audio reconnection.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/init.c

index f045f7db3ab42c9b44a07fd2fb992e1593ca693d..07acac77ea45acf86d7340e588aafb24ebe8afb0 100644 (file)
@@ -360,6 +360,12 @@ int snd_card_disconnect(struct snd_card *card)
                snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
 
        snd_info_card_disconnect(card);
+#ifndef CONFIG_SYSFS_DEPRECATED
+       if (card->card_dev) {
+               device_unregister(card->card_dev);
+               card->card_dev = NULL;
+       }
+#endif
        return 0;       
 }
 
@@ -401,10 +407,6 @@ static int snd_card_do_free(struct snd_card *card)
                snd_printk(KERN_WARNING "unable to free card info\n");
                /* Not fatal error */
        }
-#ifndef CONFIG_SYSFS_DEPRECATED
-       if (card->card_dev)
-               device_unregister(card->card_dev);
-#endif
        kfree(card);
        return 0;
 }