Skip to content

Commit

Permalink
memstick: core: fix device_register() error handling
Browse files Browse the repository at this point in the history
If device_register() fails then call put_device().  See comment to
device_register.

Signed-off-by: Vasiliy Kulikov <[email protected]>
Cc: Maxim Levitsky <[email protected]>
Cc: Alex Dubov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
segoon authored and torvalds committed Jan 13, 2011
1 parent 563558b commit 0193383
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/memstick/core/memstick.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0193383

Please sign in to comment.