Skip to content

Commit

Permalink
usb: dwc3: gadget: always decrement by 1
Browse files Browse the repository at this point in the history
We need to decrement in both cases (enq > deq and
enq < deq)

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  • Loading branch information
Felipe Balbi committed Aug 25, 2016
1 parent 696fe69 commit 6f8245b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6f8245b

Please sign in to comment.