[PATCH] phy: nuvoton: fix USB PHY clock reference leak

Wentao Liang vulab at iscas.ac.cn
Tue Nov 3 02:42:42 PST 2026


ma35_usb_phy_probe() acquires the PHY clock with of_clk_get(), which
takes a reference that must be released with clk_put().  The probe
error paths after that call return without releasing the reference,
and the driver has neither a .remove callback nor a devres-managed
clock, so the reference is also leaked when the device is unbound.

Acquire the clock with devm_clk_get() so that it is released
automatically on probe failure and on device removal.

Fixes: b48baf69db97 ("phy: nuvoton: add new driver for the Nuvoton MA35 SoC USB 2.0 PHY")
Cc: stable at vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab at iscas.ac.cn>
---
 drivers/phy/nuvoton/phy-ma35d1-usb2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/nuvoton/phy-ma35d1-usb2.c b/drivers/phy/nuvoton/phy-ma35d1-usb2.c
index 9a459b700ed4..c725e336e4f4 100644
--- a/drivers/phy/nuvoton/phy-ma35d1-usb2.c
+++ b/drivers/phy/nuvoton/phy-ma35d1-usb2.c
@@ -105,7 +105,7 @@ static int ma35_usb_phy_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(p_phy->sysreg),
 				     "Failed to get SYS registers\n");
 
-	p_phy->clk = of_clk_get(pdev->dev.of_node, 0);
+	p_phy->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(p_phy->clk))
 		return dev_err_probe(&pdev->dev, PTR_ERR(p_phy->clk),
 				     "failed to find usb_phy clock\n");
-- 
2.34.1




More information about the linux-phy mailing list