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

Commit 3ed92409 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: gadget: f_mass_storage: Add delay before continuing status stage



There is a possibility of race between ep0 setup phase completion
handler and mass storage thread. Upon set_alt if thread gets a
chance to run before dwc3_ep0_delegate_req() returns
USB_GADGET_DELAYED_STATUS and sets delayed_status flag to true status
phase request never gets queued. This results into device enumeration
failure followed by a bus resets. Fix this issue by adding delay before
calling usb_composite_setup_continue() to queue the status phase request.

Change-Id: Iec6cf668053af310be5171d19d204fb452e01f2a
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 3bfb7867
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2491,8 +2491,14 @@ static void handle_exception(struct fsg_common *common)

	case FSG_STATE_CONFIG_CHANGE:
		do_set_interface(common, common->new_fsg);
		if (common->new_fsg)
		if (common->new_fsg) {
			/*
			 * make sure delayed_status flag updated when set_alt
			 * returned.
			 */
			msleep(200);
			usb_composite_setup_continue(common->cdev);
		}
		break;

	case FSG_STATE_EXIT: