From: Greg KH <gregkh@linuxfoundation.org>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: stern@rowland.harvard.edu, colin.i.king@gmail.com,
xuetao09@huawei.com, quic_eserrao@quicinc.com,
water.zhangjiantao@huawei.com, peter.chen@freescale.com,
balbi@ti.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v1 2/2] usb: gadget: udc: core: Prevent redundant calls to pullup
Date: Wed, 5 Apr 2023 19:15:55 +0200 [thread overview]
Message-ID: <2023040520-corned-recluse-d191@gregkh> (raw)
In-Reply-To: <20230405093133.1858140-2-badhri@google.com>
On Wed, Apr 05, 2023 at 09:31:33AM +0000, Badhri Jagan Sridharan wrote:
> usb_gadget_connect calls gadget->ops->pullup without
> checking whether gadget->connected was previously set.
> Make this symmetric to usb_gadget_disconnect by returning
> early if gadget->connected is already set.
>
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> Fixes: 5a1da544e572 ("usb: gadget: core: do not try to disconnect gadget if it is not connected")
Same changelog comment as before.
> ---
> drivers/usb/gadget/udc/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index 890f92cb6344..7eeaf7dbb350 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -708,6 +708,9 @@ int usb_gadget_connect(struct usb_gadget *gadget)
> goto out;
> }
>
> + if (gadget->connected)
> + goto out;
> +
What prevents this connected value from changing right after you check
this?
thanks,
greg k-h
next prev parent reply other threads:[~2023-04-05 17:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 9:31 [PATCH v1 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started Badhri Jagan Sridharan
2023-04-05 9:31 ` [PATCH v1 2/2] usb: gadget: udc: core: Prevent redundant calls to pullup Badhri Jagan Sridharan
2023-04-05 17:15 ` Greg KH [this message]
2023-04-06 6:35 ` Badhri Jagan Sridharan
2023-04-05 17:15 ` [PATCH v1 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started Greg KH
2023-04-06 1:29 ` Alan Stern
2023-04-06 6:33 ` Badhri Jagan Sridharan
-- strict thread matches above, loose matches on Subject: below --
2023-04-06 6:19 Badhri Jagan Sridharan
2023-04-06 6:19 ` [PATCH v1 2/2] usb: gadget: udc: core: Prevent redundant calls to pullup Badhri Jagan Sridharan
2023-04-06 6:28 ` Badhri Jagan Sridharan
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=2023040520-corned-recluse-d191@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=badhri@google.com \
--cc=balbi@ti.com \
--cc=colin.i.king@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@freescale.com \
--cc=quic_eserrao@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=water.zhangjiantao@huawei.com \
--cc=xuetao09@huawei.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