提交 0193383a 编写于 作者: V Vasiliy Kulikov 提交者: 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: NVasiliy Kulikov <segooon@gmail.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册