[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <4a6e11ec91ee592689f553dc69df515b4302691b.1288099890.git.m.nazarewicz@samsung.com>
Date: Tue, 26 Oct 2010 15:38:53 +0200
From: Michal Nazarewicz <m.nazarewicz@...sung.com>
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
Rahul Ruikar <rahul.ruikar@...il.com>,
Michal Nazarewicz <mina86@...a86.com>
Subject: [PATCH 2/7] USB: gadget: f_mass_storage: put_device() in error recovery
From: Rahul Ruikar <rahul.ruikar@...il.com>
This commit fixes an issue with error recovery after
device_register() fails in Mass Storage Function. The device
needs to be put to avoid resource leakage.
Signed-off-by: Rahul Ruikar <rahul.ruikar@...il.com>
[mina86@...a86.com: updated commit message]
Signed-off-by: Michal Nazarewicz <mina86@...a86.com>
---
drivers/usb/gadget/f_mass_storage.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
I think this was in the end not accepted even though it is a valid
fix. Mass storage function does nothing in LUN's device release
function so it's safe to call put_device() (which calls release
function).
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 838286b..c89b992 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2765,6 +2765,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
if (rc) {
INFO(common, "failed to register LUN%d: %d\n", i, rc);
common->nluns = i;
+ put_device(&curlun->dev);
goto error_release;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists