diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-24 13:40:13 +0200 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-25 11:30:27 +0200 |
commit | 6f8245b4e37c2072d3daea24e19dbc0162ffd22c (patch) | |
tree | a71e25a71748e7dc8ab04fc754dcb90167df7d5b | |
parent | usb: dwc3: debug: fix ep name on trace output (diff) | |
download | linux-6f8245b4e37c2072d3daea24e19dbc0162ffd22c.tar.xz linux-6f8245b4e37c2072d3daea24e19dbc0162ffd22c.zip |
usb: dwc3: gadget: always decrement by 1
We need to decrement in both cases (enq > deq and
enq < deq)
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 122e64df2f4d..7a8d3d822b54 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -884,12 +884,9 @@ static u32 dwc3_calc_trbs_left(struct dwc3_ep *dep) return DWC3_TRB_NUM - 1; } - trbs_left = dep->trb_dequeue - dep->trb_enqueue; + trbs_left = dep->trb_dequeue - dep->trb_enqueue - 1; trbs_left &= (DWC3_TRB_NUM - 1); - if (dep->trb_dequeue < dep->trb_enqueue) - trbs_left--; - return trbs_left; } |