提交 f479d70b 编写于 作者: P Peter Korsgaard 提交者: Greg Kroah-Hartman

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: NPeter Korsgaard <jacmet@sunsite.dk>
Acked-by: NMichal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 f88f6691
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册