[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPTae5LJtkrqOC_4D0zfbp0LhEwMToXcOr31XM3gjYvf9e1B-w@mail.gmail.com>
Date: Wed, 5 Apr 2023 23:28:40 -0700
From: Badhri Jagan Sridharan <badhri@...gle.com>
To: gregkh@...uxfoundation.org, stern@...land.harvard.edu,
colin.i.king@...il.com, xuetao09@...wei.com,
quic_eserrao@...cinc.com, water.zhangjiantao@...wei.com,
peter.chen@...escale.com, balbi@...com
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH v1 2/2] usb: gadget: udc: core: Prevent redundant calls to pullup
Apologies resent V1 again instead of V2. Have sent V2 for real.
On Wed, Apr 5, 2023 at 11:19 PM Badhri Jagan Sridharan
<badhri@...gle.com> 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@...r.kernel.org
>
> Signed-off-by: Badhri Jagan Sridharan <badhri@...gle.com>
> Fixes: 5a1da544e572 ("usb: gadget: core: do not try to disconnect gadget if it is not connected")
> ---
> 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;
> +
> if (gadget->deactivated) {
> /*
> * If gadget is deactivated we only save new state.
> --
> 2.40.0.348.gf938b09366-goog
>
Powered by blists - more mailing lists