linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: linux-usb@vger.kernel.org
Cc: balbi@kernel.org, Thinh.Nguyen@synopsys.com, kernel@pengutronix.de
Subject: [PATCH 1/2] dwc3: gadget: fix setting of pending_sgs
Date: Wed, 21 Apr 2021 22:48:36 +0200	[thread overview]
Message-ID: <20210421204837.4185-2-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <20210421204837.4185-1-m.grzeschik@pengutronix.de>

In the dwc3_prepare_trbs_sg routine, when all data from request was
handled pending_sgs should be set to the number of mapped sgs that are
not queued up.

Currently the code will result in pending_sgs == queued_sgs. That
variables value will likely not be zero and break dwc3_prepare_trbs.

This patch fixes the setting of the variable to its intended purpose.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/usb/dwc3/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 6227641f2d318..118b5bcc565d6 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1242,7 +1242,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep,
 		 * don't include unused SG entries.
 		 */
 		if (length == 0) {
-			req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs;
+			req->num_pending_sgs = req->request.num_mapped_sgs - req->num_queued_sgs;
 			break;
 		}
 
-- 
2.29.2


  reply	other threads:[~2021-04-21 20:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 20:48 [PATCH 0/2] usb: dwc3: gadget: fix scatter gather support Michael Grzeschik
2021-04-21 20:48 ` Michael Grzeschik [this message]
2021-04-22 10:51   ` [PATCH 1/2] dwc3: gadget: fix setting of pending_sgs Felipe Balbi
2021-04-22 21:28   ` Thinh Nguyen
2021-04-21 20:48 ` [PATCH 2/2] dwc3: gadget: fix tracking of used sgs in request Michael Grzeschik
2021-04-22 10:56   ` Felipe Balbi
2021-04-22 20:18     ` Michael Grzeschik
2021-04-22 21:28       ` Thinh Nguyen
2021-04-23  6:17       ` Felipe Balbi
     [not found]         ` <20210423102738.GD6975@pengutronix.de>
2021-04-23 11:15           ` Felipe Balbi
2021-04-23 13:18             ` Michael Grzeschik
2021-04-24  8:16               ` Felipe Balbi
2021-04-24  9:12                 ` Michael Grzeschik
2021-04-24 13:43                   ` Felipe Balbi
2021-04-24 19:41                     ` Thinh Nguyen
2021-04-27  3:18                       ` Thinh Nguyen
2021-04-27 20:12                         ` Michael Grzeschik
2021-04-28  1:45                           ` Thinh Nguyen
2021-04-28  7:37                             ` Michael Grzeschik
2021-04-28 23:25                               ` Thinh Nguyen
2021-04-29  6:51                                 ` Michael Grzeschik
2021-04-29 18:15                                   ` Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421204837.4185-2-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).