summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorJohn Youn <johnyoun@synopsys.com>2016-05-19 17:26:10 -0700
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-06-20 12:32:44 +0300
commit89bc856e5a7462e47d90d5a3f5396bd5795efd0c (patch)
treedc101f2c6543e6e8f46dc5b696bb9aa81cc0824e /drivers/usb/dwc3
parent0d25744ad107b6c9010153f3ebf8b59672b5b8e7 (diff)
usb: dwc3: gadget: Don't prepare TRBs if no space
If trbs_left == 0, we don't have any space left in the TRB ring so don't prepare anything. Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 6408f7ff8734..663ea9ed5993 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -942,6 +942,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep)
BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM);
trbs_left = dwc3_calc_trbs_left(dep);
+ if (!trbs_left)
+ return;
list_for_each_entry_safe(req, n, &dep->pending_list, list) {
if (req->request.num_mapped_sgs > 0)