From 17a936117c587c23aafafdb9cd6d433a90daa83d Mon Sep 17 00:00:00 2001 From: Rahul Ruikar Date: Thu, 28 Oct 2010 17:31:19 +0200 Subject: [PATCH] USB: gadget: f_mass_storage: put_device() in error recovery 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 [mina86@mina86.com: updated commit message] Signed-off-by: Michal Nazarewicz Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/f_mass_storage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 838286b1cd14..c89b99295c1f 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; } -- 2.30.2