After the worker thread is launched, bind function is doing further
configuration. In case of failure stop the thread.

Signed-off-by: Sanjay Singh Rawat <snjs...@gmail.com>
Acked-by: Michal Nazarewicz <min...@mina86.com>
---
 drivers/usb/gadget/function/f_mass_storage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
b/drivers/usb/gadget/function/f_mass_storage.c
index 3cc109f..0e90e38 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -3082,7 +3082,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;
 
@@ -3125,7 +3125,10 @@ 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:
+       kthread_stop(fsg->common->thread_task);
+       return i;
 }
 
 /****************************** ALLOCATE FUNCTION *************************/
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to