summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-09 16:31:34 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-21 10:38:43 +0300
commitf2df679b6c556fd3b0b7ffafea170f1679086455 (patch)
tree0500be613c0f89d593ea26ebdb4aad5da888640d /drivers
parentd807bdd02845d53047346a4ba6d8934597fba6d6 (diff)
usb: dwc3: gadget: avoid while(1) in run_stop()
instead of looping forever and forcing a return if timeout reaches zero, we can just use timeout and loop's break condition directly. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/gadget.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index b3b5df6dcbd2..9b9367b22ad3 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1581,10 +1581,10 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
if (reg & DWC3_DSTS_DEVCTRLHLT)
break;
}
- timeout--;
- if (!timeout)
- return -ETIMEDOUT;
- } while (1);
+ } while (--timeout);
+
+ if (!timeout)
+ return -ETIMEDOUT;
dwc3_trace(trace_dwc3_gadget, "gadget %s data soft-%s",
dwc->gadget_driver