Unverified Commit fbb22bb9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14888 usb: dwc3: gadget: Fix looping of queued SG entries

parents bcff6297 498f7704
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1433,8 +1433,8 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep,
	struct scatterlist *s;
	int		i;
	unsigned int length = req->request.length;
	unsigned int remaining = req->request.num_mapped_sgs
		- req->num_queued_sgs;
	unsigned int remaining = req->num_pending_sgs;
	unsigned int num_queued_sgs = req->request.num_mapped_sgs - remaining;
	unsigned int num_trbs = req->num_trbs;
	bool needs_extra_trb = dwc3_needs_extra_trb(dep, req);

@@ -1442,7 +1442,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep,
	 * If we resume preparing the request, then get the remaining length of
	 * the request and resume where we left off.
	 */
	for_each_sg(req->request.sg, s, req->num_queued_sgs, i)
	for_each_sg(req->request.sg, s, num_queued_sgs, i)
		length -= sg_dma_len(s);

	for_each_sg(sg, s, remaining, i) {