From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Felipe Balbi <balbi@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: John Youn <John.Youn@synopsys.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] usb: dwc3: gadget: Fix request completion check
Date: Fri, 17 Apr 2020 01:29:47 +0000 [thread overview]
Message-ID: <5cdcb770-fb6a-14fe-e652-857234c9f69c@synopsys.com> (raw)
In-Reply-To: <bed19f474892bb74be92b762c6727a6a7d0106e4.1585643834.git.thinhn@synopsys.com>
Hi Felipe,
Thinh Nguyen wrote:
> A request may not be completed because not all the TRBs are prepared for
> it. This happens when we run out of available TRBs. When some TRBs are
> completed, the driver needs to prepare the rest of the TRBs for the
> request. The check dwc3_gadget_ep_request_completed() shouldn't be
> checking the amount of data received but rather the number of pending
> TRBs. Revise this request completion check.
>
> Cc: stable@vger.kernel.org
> Fixes: e0c42ce590fe ("usb: dwc3: gadget: simplify IOC handling")
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
> Changes in v2:
> - Add Cc: stable tag
>
> drivers/usb/dwc3/gadget.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 1a4fc03742aa..c45853b14cff 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2550,14 +2550,7 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep,
>
> static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req)
> {
> - /*
> - * For OUT direction, host may send less than the setup
> - * length. Return true for all OUT requests.
> - */
> - if (!req->direction)
> - return true;
> -
> - return req->request.actual == req->request.length;
> + return req->num_pending_sgs == 0;
> }
>
> static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
> @@ -2581,8 +2574,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
>
> req->request.actual = req->request.length - req->remaining;
>
> - if (!dwc3_gadget_ep_request_completed(req) ||
> - req->num_pending_sgs) {
> + if (!dwc3_gadget_ep_request_completed(req)) {
> __dwc3_gadget_kick_transfer(dep);
> goto out;
> }
Since you'll be picking this up for the rc cycle for your fix patches,
should I split this series to resend and wait for this patch to be
merged first before I resend the patch 2/2?
Let me know how you'd like to proceed.
Thanks,
Thinh
next prev parent reply other threads:[~2020-04-17 1:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 8:40 [PATCH v2 1/2] usb: dwc3: gadget: Fix request completion check Thinh Nguyen
2020-04-17 1:29 ` Thinh Nguyen [this message]
2020-04-17 7:06 ` Felipe Balbi
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=5cdcb770-fb6a-14fe-e652-857234c9f69c@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=John.Youn@synopsys.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@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).