aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memstick/core
diff options
context:
space:
mode:
authorVasiliy Kulikov <segooon@gmail.com>2011-01-12 20:01:00 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 11:03:21 -0500
commit0193383a5833c1f082c738eaca868e4093a8df39 (patch)
tree79e2f43e17934b2e1ec015f6d76cd0b96b0d627d /drivers/memstick/core
parent563558b2c7350371551bf08348ac61be62200505 (diff)
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>
Diffstat (limited to 'drivers/memstick/core')
-rw-r--r--drivers/memstick/core/memstick.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index c00fe8253c51..4303b7ef73e2 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -465,6 +465,7 @@ static void memstick_check(struct work_struct *work)
465 if (!host->card) { 465 if (!host->card) {
466 host->card = card; 466 host->card = card;
467 if (device_register(&card->dev)) { 467 if (device_register(&card->dev)) {
468 put_device(&card->dev);
468 kfree(host->card); 469 kfree(host->card);
469 host->card = NULL; 470 host->card = NULL;
470 } 471 }