[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <70376CA23424B34D86F1C7DE6B9973430254343ABF@VSHINMSMBX01.vshodc.lntinfotech.com>
Date: Wed, 12 May 2010 16:03:43 +0530
From: Viral Mehta <Viral.Mehta@...infotech.com>
To: MichaĆ Nazarewicz <m.nazarewicz@...sung.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>
CC: Kyungmin Park <kyungmin.park@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] USB: gadget: f_mass_storage: fix in fsg_common_init()
error recovery
>Because of that, I the "goto error_release" to be cleaner in the sense that
>there is a single error recovery path and only one place where
>free_storage_on_release flag is checked and common freed.
In that case, in addition to your previous patch, below hunk is needed
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index f4911c0..b1648fc 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2883,15 +2883,16 @@ static void fsg_common_release(struct kref *ref)
/* Beware tempting for -> do-while optimization: when in error
* recovery nluns may be zero. */
+ if(common->luns) {
+ for (; i; --i, ++lun) {
+ device_remove_file(&lun->dev, &dev_attr_ro);
+ device_remove_file(&lun->dev, &dev_attr_file);
+ fsg_lun_close(lun);
+ device_unregister(&lun->dev);
+ }
- for (; i; --i, ++lun) {
- device_remove_file(&lun->dev, &dev_attr_ro);
- device_remove_file(&lun->dev, &dev_attr_file);
- fsg_lun_close(lun);
- device_unregister(&lun->dev);
+ kfree(common->luns);
}
-
- kfree(common->luns);
if (common->free_storage_on_release)
kfree(common);
}
Thanks,
Viral
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
--
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