Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f479d70b authored by Peter Korsgaard's avatar Peter Korsgaard Committed by Greg Kroah-Hartman
Browse files

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: default avatarPeter Korsgaard <jacmet@sunsite.dk>
Acked-by: default avatarMichal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f88f6691
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -2954,7 +2954,6 @@ static int __init fsg_bind(struct usb_configuration *c, struct usb_function *f)
autoconf_fail:
autoconf_fail:
	ERROR(fsg, "unable to autoconfigure all endpoints\n");
	ERROR(fsg, "unable to autoconfigure all endpoints\n");
	rc = -ENOTSUPP;
	rc = -ENOTSUPP;
	fsg_unbind(c, f);
	return rc;
	return rc;
}
}