usb: dwc3: gadget: decrement trbs_left for each sg entry
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 30 May 2016 10:42:33 +0000 (13:42 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 20 Jun 2016 09:32:51 +0000 (12:32 +0300)
If we don't, we will overwrite valid TRBs.

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

index 3d2978cebdffb95ddd6cce4a50c8393d118276fb..d2884a414e2004859f89b713c22dc0db555d8f42 100644 (file)
@@ -924,7 +924,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                        chain = false;
                }
 
-               if (!trbs_left)
+               if (!trbs_left--)
                        last = true;
 
                if (last)