[PATCH v2] phy: hisilicon: fix UTMI reset leaks in INNO USB2 PHY
From: Xia Yan
Date: Mon Nov 30 2026 - 20:25:32 EST
hisi_inno_phy_probe() acquires an exclusive UTMI reset control for each
child node but never releases it on probe failure or driver detach.
The leaked controls remain acquired, so a later probe can fail with
-EBUSY when requesting the same resets.
Register a devres action after each successful lookup to release the
control on probe failure and detach.
Found during source review of reset-control lifetimes.
Build-tested the driver object on x86_64 with W=1 and reset support
enabled. No hardware testing.
Fixes: ba8b0ee81fbb ("phy: add inno-usb2-phy driver for hi3798cv200 SoC")
Reviewed-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
Signed-off-by: Xia Yan <yanxia@xxxxxxxxxxxxxxxxxxxx>
---
Notes (hisi-inno-v2-20261201):
Changes in v2:
- Drop the stable Cc as requested by Manivannan Sadhasivam.
- Wrap the devm_add_action_or_reset() call to stay within 80 columns.
- Add the Reviewed-by tags from Philipp Zabel and Manivannan Sadhasivam.
v1: https://lore.kernel.org/linux-phy/20261111085942.159625-1-yanxia@xxxxxxxxxxxxxxxxxxxx/
Review: https://lore.kernel.org/linux-phy/179578227492.13164.6236523920077624562.b4-reply@b4/
drivers/phy/hisilicon/phy-hisi-inno-usb2.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
index c843923252aace2afeb41e5082cd8e4a16625966..353d15c76ad260bc8786f09d8300b39f27ebeb24 100644
--- a/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
+++ b/drivers/phy/hisilicon/phy-hisi-inno-usb2.c
@@ -132,6 +132,11 @@ static const struct phy_ops hisi_inno_phy_ops = {
.owner = THIS_MODULE,
};
+static void hisi_inno_phy_reset_put(void *data)
+{
+ reset_control_put(data);
+}
+
static int hisi_inno_phy_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -169,6 +174,11 @@ static int hisi_inno_phy_probe(struct platform_device *pdev)
if (IS_ERR(rst))
return PTR_ERR(rst);
+ ret = devm_add_action_or_reset(dev, hisi_inno_phy_reset_put,
+ rst);
+ if (ret)
+ return ret;
+
priv->ports[i].utmi_rst = rst;
priv->ports[i].priv = priv;
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4