[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230407024616.2883701-2-badhri@google.com>
Date: Fri, 7 Apr 2023 02:46:16 +0000
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, Badhri Jagan Sridharan <badhri@...gle.com>
Subject: [PATCH v3 2/2] usb: gadget: udc: core: Prevent redundant calls to pullup
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
Fixes: 5a1da544e572 ("usb: gadget: core: do not try to disconnect gadget if it is not connected")
Signed-off-by: Badhri Jagan Sridharan <badhri@...gle.com>
---
Changes since v2:
* none
Changes since v1:
* Fixed commit message comments.
---
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 3eb5d4e392db..7e9ce872451e 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -702,6 +702,9 @@ int usb_gadget_connect_locked(struct usb_gadget *gadget) __must_hold(&gadget->ud
goto out;
}
+ if (gadget->connected)
+ goto out;
+
if (gadget->deactivated || !gadget->udc->started) {
/*
* If gadget is deactivated we only save new state.
--
2.40.0.577.gac1e443424-goog
Powered by blists - more mailing lists