USB: gadget: f_mass_storage::fsg_bind(): fix error handling
authorPeter Korsgaard <jacmet@sunsite.dk>
Fri, 12 Mar 2010 14:55:28 +0000 (15:55 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 19 Mar 2010 14:24:20 +0000 (07:24 -0700)
Contrary to the comment in fsg_add, fsg_bind calls fsg_unbind on errors,
which decreases refcount and frees the fsg_dev structure, causing trouble
when fsg_add does the same.

Fix it by simply leaving up cleanup to fsg_add().

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/f_mass_storage.c

index db08de2af18293bf5fade582636b8f177b185285..f4911c09022e92c2c16cc1b294045a56a0aca231 100644 (file)
@@ -2954,7 +2954,6 @@ static int __init fsg_bind(struct usb_configuration *c, struct usb_function *f)
 autoconf_fail:
        ERROR(fsg, "unable to autoconfigure all endpoints\n");
        rc = -ENOTSUPP;
-       fsg_unbind(c, f);
        return rc;
 }