From: Peter Chen <peter.chen@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
jun.li@nxp.com, linux-imx@nxp.com
Subject: Re: [PATCH] usb: chipidea: udc: check request status before setting device address
Date: Sun, 3 Jul 2022 08:42:09 +0800 [thread overview]
Message-ID: <20220703004209.GB1382015@Peter> (raw)
In-Reply-To: <20220623030242.41796-1-xu.yang_2@nxp.com>
On 22-06-23 11:02:42, Xu Yang wrote:
> The complete() function may be called even though request is not
> completed.
Would you please explain more when the complete() is called but the
request has not completed, and this happens before set_address has
finished?
Peter
> In this case, it's necessary to check request status so
> as not to set device address wrongly.
>
> Fixes: 10775eb17bee ("usb: chipidea: udc: update gadget states according to ch9")
> cc: <stable@vger.kernel.org>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
> drivers/usb/chipidea/udc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 0c9ae9768a67..8c3e3a635ac2 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -1048,6 +1048,9 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
> struct ci_hdrc *ci = req->context;
> unsigned long flags;
>
> + if (req->status < 0)
> + return;
> +
> if (ci->setaddr) {
> hw_usb_set_address(ci, ci->address);
> ci->setaddr = false;
> --
> 2.25.1
>
--
Thanks,
Peter Chen
next prev parent reply other threads:[~2022-07-03 0:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 3:02 [PATCH] usb: chipidea: udc: check request status before setting device address Xu Yang
2022-07-03 0:42 ` Peter Chen [this message]
2022-07-04 1:59 ` [EXT] " Xu Yang
2022-07-09 10:00 ` Peter Chen
2022-07-11 1:36 ` Xu Yang
2022-07-12 1:22 ` Peter Chen
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=20220703004209.GB1382015@Peter \
--to=peter.chen@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=xu.yang_2@nxp.com \
/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