mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
memstick: core: fix device_register() error handling
If device_register() fails then call put_device(). See comment to device_register. Signed-off-by: Vasiliy Kulikov <segooon@gmail.com> Cc: Maxim Levitsky <maximlevitsky@gmail.com> Cc: Alex Dubov <oakad@yahoo.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
563558b2c7
commit
0193383a58
@ -465,6 +465,7 @@ static void memstick_check(struct work_struct *work)
|
||||
if (!host->card) {
|
||||
host->card = card;
|
||||
if (device_register(&card->dev)) {
|
||||
put_device(&card->dev);
|
||||
kfree(host->card);
|
||||
host->card = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user