From: Vasiliy Kulikov Date: Thu, 13 Jan 2011 01:01:00 +0000 (-0800) Subject: memstick: core: fix device_register() error handling X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0193383a5833c1f082c738eaca868e4093a8df39;p=linux-beck.git 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 Cc: Maxim Levitsky Cc: Alex Dubov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) if (!host->card) { host->card = card; if (device_register(&card->dev)) { + put_device(&card->dev); kfree(host->card); host->card = NULL; }