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

Commit f6bb225b authored by Felipe Balbi's avatar Felipe Balbi
Browse files

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.

Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent ba159841
Loading
Loading
Loading
Loading
+6 −12
Original line number Original line Diff line number Diff line
@@ -327,19 +327,13 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,


			break;
			break;
		}
		}
	} while (--timeout);


		/*
	if (timeout == 0) {
		 * We can't sleep here, because it is also called from
		 * interrupt context.
		 */
		timeout--;
		if (!timeout) {
		dwc3_trace(trace_dwc3_gadget,
		dwc3_trace(trace_dwc3_gadget,
				"Command Timed Out");
				"Command Timed Out");
		ret = -ETIMEDOUT;
		ret = -ETIMEDOUT;
			break;
	}
	}
	} while (1);


	if (unlikely(susphy)) {
	if (unlikely(susphy)) {
		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));