From: Felipe Balbi Date: Mon, 30 May 2016 10:42:33 +0000 (+0300) Subject: UPSTREAM: usb: dwc3: gadget: decrement trbs_left for each sg entry X-Git-Tag: firefly_0821_release~1783 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0d92fc598c00df40d94a3cd24730e9b633a6e745;p=firefly-linux-kernel-4.4.55.git UPSTREAM: usb: dwc3: gadget: decrement trbs_left for each sg entry If we don't, we will overwrite valid TRBs. Change-Id: I8076fa857b9ae016617d58836de3d9dcf5be9e4c Signed-off-by: Felipe Balbi Signed-off-by: Wu Liang feng (cherry picked from commit d6dc2e76a860d6be0129daae43e5f12461531d20) --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 178cf6581cfe..5a4d7d855639 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -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)