diff options
author | Sanjay Singh Rawat <snjsrwt@gmail.com> | 2015-07-22 16:29:46 +0530 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-07-30 11:43:37 -0500 |
commit | 8078f314b8c8012cf36e5decc75378b803bfba4d (patch) | |
tree | d662ead674bcf948c4fe69becddcaa131084a49d /drivers/usb/gadget/function/f_mass_storage.c | |
parent | 5feb5d2003499b1094d898c010a7604d7afddc4c (diff) | |
download | linux-8078f314b8c8012cf36e5decc75378b803bfba4d.tar.bz2 |
usb: gadget: f_mass_storage: stop thread in bind failure case
After the worker thread is launched, bind function is doing further
configuration. In case of failure stop the thread.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Sanjay Singh Rawat <snjsrwt@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/function/f_mass_storage.c')
-rw-r--r-- | drivers/usb/gadget/function/f_mass_storage.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c index a2291946ca7e..f94a8e2e9b60 100644 --- a/drivers/usb/gadget/function/f_mass_storage.c +++ b/drivers/usb/gadget/function/f_mass_storage.c @@ -3081,7 +3081,7 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) /* New interface */ i = usb_interface_id(c, f); if (i < 0) - return i; + goto fail; fsg_intf_desc.bInterfaceNumber = i; fsg->interface_number = i; @@ -3124,7 +3124,14 @@ static int fsg_bind(struct usb_configuration *c, struct usb_function *f) autoconf_fail: ERROR(fsg, "unable to autoconfigure all endpoints\n"); - return -ENOTSUPP; + i = -ENOTSUPP; +fail: + /* terminate the thread */ + if (fsg->common->state != FSG_STATE_TERMINATED) { + raise_exception(fsg->common, FSG_STATE_EXIT); + wait_for_completion(&fsg->common->thread_notifier); + } + return i; } /****************************** ALLOCATE FUNCTION *************************/ |