From: Peter Korsgaard Date: Fri, 12 Mar 2010 14:55:28 +0000 (+0100) Subject: USB: gadget: f_mass_storage::fsg_bind(): fix error handling X-Git-Tag: v2.6.34-rc2~8^2~9 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=f479d70b4f7674083c2e3c3e603b15811713fb18;p=~shefty%2Frdma-dev.git USB: gadget: f_mass_storage::fsg_bind(): fix error handling 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 Acked-by: Michal Nazarewicz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index db08de2af18..f4911c09022 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -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; }