summaryrefslogtreecommitdiff
path: root/sound/core/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 3058d626a90a..6152a7554dfd 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -361,6 +361,8 @@ static int snd_card_do_free(struct snd_card *card)
snd_printk(KERN_WARNING "unable to free card info\n");
/* Not fatal error */
}
+ if (card->dev)
+ device_unregister(card->dev);
kfree(card);
return 0;
}
@@ -495,6 +497,12 @@ int snd_card_register(struct snd_card *card)
int err;
snd_assert(card != NULL, return -EINVAL);
+ if (!card->dev) {
+ card->dev = device_create(sound_class, card->parent, 0,
+ "card%i", card->number);
+ if (IS_ERR(card->dev))
+ card->dev = NULL;
+ }
if ((err = snd_device_register_all(card)) < 0)
return err;
mutex_lock(&snd_card_mutex);