summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2013-07-22 13:31:31 +0400
committerFelipe Balbi <balbi@ti.com>2013-07-29 14:57:03 +0400
commit7a42d83536a5ea7ea7b4ad279c34c4c4ce509b5a (patch)
treef4b6632736d94fa4a3c15a07df8027487340dc03
parent5702f75375aa9ecf8ad3431aef3fe6ce8c8dbd15 (diff)
downloadlinux-7a42d83536a5ea7ea7b4ad279c34c4c4ce509b5a.tar.xz
usb: dwc3: ep0: only change to ADDRESS if set_config() succeeds
In case we're switching back to USB_STATE_ADDRESS from USB_STATE_CONFIGURED (if host sends a set configuration command for configuration zero), we should only switch if the request is successfully processed by the gadget driver. Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/dwc3/ep0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index e9d099cee636..007651c21638 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -551,7 +551,7 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
case USB_STATE_CONFIGURED:
ret = dwc3_ep0_delegate_req(dwc, ctrl);
- if (!cfg)
+ if (!cfg && !ret)
usb_gadget_set_state(&dwc->gadget,
USB_STATE_ADDRESS);
break;