summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_mass_storage.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2010-10-28 17:31:18 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-11-11 05:58:48 -0800
commitd9385b6352da7fed50981f375c2ccb60354039a6 (patch)
tree2b9c8dc9fcb6b6452634c853712bba71993ac797 /drivers/usb/gadget/f_mass_storage.c
parent78bff3c65df33da47e93736bd8847b694084e5a9 (diff)
USB: gadget: file_storage: put_device() in error recovery
This commit fixes some issues with File-backed Storage Gadget error recovery when registering LUN's devices. First of all, when device_register() fails the device still needs to be put. However, because lun_release() decreases fsg->ref reference counter the counter must be incremented beforehand. Second of all, after any of the device_create_file()s fails, device_unregister() is called which in turn (indirectly) calls lun_release() which decrements fsg->ref. So, again, the reference counter must be incremented beforehand. Lastly, if the first or the second device_create_file() succeeds, the files are never removed. To fix it, device_remove_file() needs to be called. This is done by simply marking LUN as registered prior to creating files so that fsg_unbind() can handle removing files. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Reported-by: Rahul Ruikar <rahul.ruikar@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/f_mass_storage.c')
0 files changed, 0 insertions, 0 deletions