Commit 8078f314 authored by Sanjay Singh Rawat's avatar Sanjay Singh Rawat Committed by Felipe Balbi

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: default avatarMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: default avatarSanjay Singh Rawat <snjsrwt@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5feb5d20
......@@ -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 *************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment