aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2017-01-19 06:38:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-12 00:41:48 -0500
commit3ccf60e1ff5e6cbd47b860b95f6cb53ebd98113b (patch)
treedf145764aad453366efc2274fca624911d3e5527
parent5413f432a1f33293b9183fadb1b44e29b168aa24 (diff)
usb: dwc3: gadget: skip Set/Clear Halt when invalid
commit ffb80fc672c3a7b6afd0cefcb1524fb99917b2f3 upstream. At least macOS seems to be sending ClearFeature(ENDPOINT_HALT) to endpoints which aren't Halted. This makes DWC3's CLEARSTALL command time out which causes several issues for the driver. Instead, let's just return 0 and bail out early. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/dwc3/gadget.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index d2b860ebfe13..5dc6bfc91f4b 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1234,6 +1234,9 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
1234 unsigned transfer_in_flight; 1234 unsigned transfer_in_flight;
1235 unsigned started; 1235 unsigned started;
1236 1236
1237 if (dep->flags & DWC3_EP_STALL)
1238 return 0;
1239
1237 if (dep->number > 1) 1240 if (dep->number > 1)
1238 trb = dwc3_ep_prev_trb(dep, dep->trb_enqueue); 1241 trb = dwc3_ep_prev_trb(dep, dep->trb_enqueue);
1239 else 1242 else
@@ -1258,6 +1261,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
1258 else 1261 else
1259 dep->flags |= DWC3_EP_STALL; 1262 dep->flags |= DWC3_EP_STALL;
1260 } else { 1263 } else {
1264 if (!(dep->flags & DWC3_EP_STALL))
1265 return 0;
1261 1266
1262 ret = dwc3_send_clear_stall_ep_cmd(dep); 1267 ret = dwc3_send_clear_stall_ep_cmd(dep);
1263 if (ret) 1268 if (ret)