USB: gadget: f_mass_storage: fix in error recovery
authorMichal Nazarewicz <m.nazarewicz@samsung.com>
Wed, 12 May 2010 10:51:13 +0000 (12:51 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 20 May 2010 20:21:45 +0000 (13:21 -0700)
commitb9e000884e50bf6b25a92a3f3580e1d14fe01591
tree05188e049219fed1cacc50f09e1d62a296d95bbe
parentf537da685c35a81a75f6067751bddb902c8adb68
USB: gadget: f_mass_storage: fix in error recovery

In to places in fsg_common_init() an unconditional call to kfree()
on common was performed in error recovery which is not a valid
behaviour since fsg_common structure is not always allocated by
fsg_common_init().

To fix, the calls has been replaced with a goto to a proper error
recovery which does the correct thing.

Also, refactored fsg_common_release() function.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: Viral Mehta <viral.mehta@lntinfotech.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c