instead of having infinite loop and always checking
timeout value as a break condition, we can just
decrement timeout inside while's condition.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
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));