aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-04-17 06:50:47 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:39 -0400
commit73d38b13ffb105ab633bd91969c8d218b2de38d4 (patch)
treee7bada137d13b41e6859c8397cfaa5b6e837f444
parent20861fa7b20a40ca045393df634d4d51e61efa58 (diff)
[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)
360 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number); 360 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
361 361
362 snd_info_card_disconnect(card); 362 snd_info_card_disconnect(card);
363#ifndef CONFIG_SYSFS_DEPRECATED
364 if (card->card_dev) {
365 device_unregister(card->card_dev);
366 card->card_dev = NULL;
367 }
368#endif
363 return 0; 369 return 0;
364} 370}
365 371
@@ -401,10 +407,6 @@ static int snd_card_do_free(struct snd_card *card)
401 snd_printk(KERN_WARNING "unable to free card info\n"); 407 snd_printk(KERN_WARNING "unable to free card info\n");
402 /* Not fatal error */ 408 /* Not fatal error */
403 } 409 }
404#ifndef CONFIG_SYSFS_DEPRECATED
405 if (card->card_dev)
406 device_unregister(card->card_dev);
407#endif
408 kfree(card); 410 kfree(card);
409 return 0; 411 return 0;
410} 412}