lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 16 Dec 2023 03:43:35 +0000
From: Badhri Jagan Sridharan <badhri@...gle.com>
To: Thinh.Nguyen@...opsys.com, gregkh@...uxfoundation.org, raychi@...gle.com, 
	royluo@...gle.com
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Badhri Jagan Sridharan <badhri@...gle.com>, stable@...r.kernel.org
Subject: [PATCH v1 2/2] usb: gadget: Retry populating usb-psy when null

This patch allows populating usb-psy where usb-psy comes up
after dwc3 is probed. Retry populating usb-psy when dwc->usb_psy
is null while dwc3_gadget_vbus_draw() is executed.

Cc: stable@...r.kernel.org
Fixes: 99288de36020 ("usb: dwc3: add an alternate path in vbus_draw callback")
Signed-off-by: Badhri Jagan Sridharan <badhri@...gle.com>
---
 drivers/usb/dwc3/gadget.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 858fe4c299b7..b3470a5e5e26 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3049,8 +3049,11 @@ static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA)
 	if (dwc->usb2_phy)
 		return usb_phy_set_power(dwc->usb2_phy, mA);
 
-	if (!dwc->usb_psy)
-		return -EOPNOTSUPP;
+	if (!dwc->usb_psy) {
+		dwc3_populate_usb_psy(dwc);
+		if (!dwc->usb_psy)
+			return -EOPNOTSUPP;
+	}
 
 	val.intval = 1000 * mA;
 	ret = power_supply_set_property(dwc->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);
-- 
2.43.0.472.g3155946c3a-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ