summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-04-17 12:50:47 +0200
committerTakashi Iwai <tiwai@suse.de>2008-04-24 12:00:39 +0200
commit73d38b13ffb105ab633bd91969c8d218b2de38d4 (patch)
treee7bada137d13b41e6859c8397cfaa5b6e837f444
parent[ALSA] snd-powermac: style burgundy.c (diff)
downloadlinux-73d38b13ffb105ab633bd91969c8d218b2de38d4.tar.xz
linux-73d38b13ffb105ab633bd91969c8d218b2de38d4.zip
[ALSA] Fix the race of card instance unregistration
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>
-rw-r--r--sound/core/init.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index f045f7db3ab4..07acac77ea45 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -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;
}