diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-24 14:40:13 +0300 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2016-08-25 12:30:27 +0300 |
commit | 6f8245b4e37c2072d3daea24e19dbc0162ffd22c (patch) | |
tree | a71e25a71748e7dc8ab04fc754dcb90167df7d5b | |
parent | 696fe69d7e631f00f23b0ef1694d9b90058dca54 (diff) |
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; } |