From: Felipe Balbi <balbi@kernel.org>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thinh.Nguyen@synopsys.com, linux-usb@vger.kernel.org
Cc: John Youn <John.Youn@synopsys.com>, stable@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: dwc3: gadget: Check if the gadget had stopped
Date: Wed, 06 Jan 2021 09:54:00 +0200 [thread overview]
Message-ID: <877doqcxgn.fsf@kernel.org> (raw)
In-Reply-To: <9d057f37b82083af331fb6225d7c7ef3d1840a6e.1609865348.git.Thinh.Nguyen@synopsys.com>
Hi,
Thinh Nguyen <Thinh.Nguyen@synopsys.com> writes:
> If the gadget had already stopped, don't try to stop again. Otherwise
> we'd get a warning for trying to free an already freed irq. This can
> happen if a user tries to trigger a soft-disconnect from soft_connect
> sysfs multiple times. The fix is to check if there's a bounded gadget
> driver to determined if the gadget had stopped.
>
> Cc: stable@vger.kernel.org
> Fixes: 8698e2acf3a5 ("usb: dwc3: gadget: introduce and use enable/disable irq methods")
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
> drivers/usb/dwc3/gadget.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 51d81a32ce78..9ec70282e610 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2338,6 +2338,10 @@ static int dwc3_gadget_stop(struct usb_gadget *g)
> struct dwc3 *dwc = gadget_to_dwc(g);
> unsigned long flags;
>
> + /* The controller is already stopped if there's no gadget driver */
> + if (!dwc->gadget_driver)
> + return 0;
same here. Better done at the framework
--
balbi
next prev parent reply other threads:[~2021-01-06 7:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 16:56 [PATCH 0/2] usb: dwc3: gadget: Check for multiple start/stop Thinh Nguyen
2021-01-05 16:56 ` [PATCH 1/2] usb: dwc3: gadget: Check if the gadget had started Thinh Nguyen
2021-01-06 7:53 ` Felipe Balbi
2021-01-06 9:35 ` Thinh Nguyen
2021-01-05 16:56 ` [PATCH 2/2] usb: dwc3: gadget: Check if the gadget had stopped Thinh Nguyen
2021-01-06 7:54 ` Felipe Balbi [this message]
2021-01-08 2:36 ` [PATCH 0/2] usb: dwc3: gadget: Check for multiple start/stop Peter Chen
2021-01-08 2:40 ` Thinh Nguyen
2021-01-08 9:40 ` 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=877doqcxgn.fsf@kernel.org \
--to=balbi@kernel.org \
--cc=John.Youn@synopsys.com \
--cc=Thinh.Nguyen@synopsys.com \
--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