mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
UPSTREAM: usb: dwc3: gadget: loop while (timeout)
instead of having infinite loop and always checking
timeout value as a break condition, we can just
decrement timeout inside while's condition.
Change-Id: I665d39e7205463f5f4439f3a6d4fdfc6e3ed67b2
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
(cherry picked from commit f6bb225bb3)
This commit is contained in:
@@ -327,19 +327,13 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
|
||||
|
||||
break;
|
||||
}
|
||||
} while (--timeout);
|
||||
|
||||
/*
|
||||
* We can't sleep here, because it is also called from
|
||||
* interrupt context.
|
||||
*/
|
||||
timeout--;
|
||||
if (!timeout) {
|
||||
dwc3_trace(trace_dwc3_gadget,
|
||||
"Command Timed Out");
|
||||
ret = -ETIMEDOUT;
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
if (timeout == 0) {
|
||||
dwc3_trace(trace_dwc3_gadget,
|
||||
"Command Timed Out");
|
||||
ret = -ETIMEDOUT;
|
||||
}
|
||||
|
||||
if (unlikely(susphy)) {
|
||||
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
|
||||
|
||||
Reference in New Issue
Block a user