Commit 0193383a authored by Vasiliy Kulikov's avatar Vasiliy Kulikov Committed by Linus Torvalds

memstick: core: fix device_register() error handling

If device_register() fails then call put_device().  See comment to
device_register.
Signed-off-by: default avatarVasiliy Kulikov <segooon@gmail.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 563558b2
...@@ -465,6 +465,7 @@ static void memstick_check(struct work_struct *work) ...@@ -465,6 +465,7 @@ static void memstick_check(struct work_struct *work)
if (!host->card) { if (!host->card) {
host->card = card; host->card = card;
if (device_register(&card->dev)) { if (device_register(&card->dev)) {
put_device(&card->dev);
kfree(host->card); kfree(host->card);
host->card = NULL; host->card = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment