Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: phy: twl6030-usb: disable usb3v3 before releasing it
@ 2026-11-19  8:15 Wang Haoran
  2026-11-19  8:29 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Haoran @ 2026-11-19  8:15 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, wanghr2026

The VBUS and ID interrupt handlers enable usb3v3 and track the state in
twl->asleep, but the remove path only calls regulator_put(), which warns on
the still-held enable count and leaves the LDO powered until the PMIC
itself powers down. Unbinding with an ID-grounded cable therefore leaves
the USB PHY rail enabled and pollutes dmesg with the enable_count WARN on
every unbind.

Disable usb3v3 in remove and in the probe error path when it was left
enabled, guarded by the existing asleep state.

Signed-off-by: Wang Haoran <wanghr2026@mail.zgclab.edu.cn>
Fixes: c33fad0c3748 ("usb: otg: Adding twl6030-usb transceiver driver for OMAP4430")
---

diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
index 9bfcb2c1dfd0..6a53417ecad4 100644
--- a/drivers/usb/phy/phy-twl6030-usb.c
+++ b/drivers/usb/phy/phy-twl6030-usb.c
@@ -403,6 +403,8 @@ static int twl6030_usb_probe(struct platform_device *pdev)
 err_free_irq1:
 	free_irq(twl->irq1, twl);
 err_put_regulator:
+	if (twl->asleep)
+		regulator_disable(twl->usb3v3);
 	regulator_put(twl->usb3v3);
 
 	return status;
@@ -419,6 +421,8 @@ static void twl6030_usb_remove(struct platform_device *pdev)
 			REG_INT_MSK_STS_C);
 	free_irq(twl->irq1, twl);
 	free_irq(twl->irq2, twl);
+	if (twl->asleep)
+		regulator_disable(twl->usb3v3);
 	regulator_put(twl->usb3v3);
 	cancel_work_sync(&twl->set_vbus_work);
 }

---

The vulnerability was found by static analysis.


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  8:15 [PATCH] usb: phy: twl6030-usb: disable usb3v3 before releasing it Wang Haoran
2026-11-19  8:29 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox