[PATCH] usb: phy: twl6030-usb: disable usb3v3 before releasing it

From: Wang Haoran

Date: Thu Nov 19 2026 - 03:16:30 EST


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@xxxxxxxxxxxxxxxxxx>
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.