usb: dwc3: gadget: stop kicking if we run out of space
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 24 Aug 2016 11:38:10 +0000 (14:38 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 25 Aug 2016 09:13:21 +0000 (12:13 +0300)
In case our TRB ring is full, we can avoid trying to
kick transfers which won't start and just add requests
to the queue.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/gadget.c

index 104b145f506de76a54f573eb420cc423954f0861..37a86522fa881f4887a60fce1b3ca01c8cba5755 100644 (file)
@@ -1082,6 +1082,9 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
                return 0;
        }
 
+       if (!dwc3_calc_trbs_left(dep))
+               return 0;
+
        ret = __dwc3_gadget_kick_transfer(dep, 0);
        if (ret && ret != -EBUSY)
                dwc3_trace(trace_dwc3_gadget,