[PATCH] mdio-airoha: fix refcount leak in airoha_mdio_probe()

From: Wentao Liang

Date: Tue Jun 09 2026 - 05:16:04 EST


In airoha_mdio_probe(), after calling reset_control_deassert(),
if clk_set_rate() fails, the function returns immediately without
calling reset_control_assert(). This leaves the reset line
deasserted and causes a reference count leak on shared reset
controllers. The devm cleanup does not assert the reset line, so
the unbalanced deassert persists.

Fix this by adding a reset_control_assert() call on the
clk_set_rate() error path, matching the existing error handling
for devm_of_mdiobus_register().

Cc: stable@xxxxxxxxxxxxxxx
Fixes: 67e3ba978361 ("net: mdio: Add MDIO bus controller for Airoha AN7583")
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/net/mdio/mdio-airoha.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-airoha.c b/drivers/net/mdio/mdio-airoha.c
index 52e7475121ea..030482b8318f 100644
--- a/drivers/net/mdio/mdio-airoha.c
+++ b/drivers/net/mdio/mdio-airoha.c
@@ -245,8 +245,10 @@ static int airoha_mdio_probe(struct platform_device *pdev)
freq = 2500000;

ret = clk_set_rate(priv->clk, freq);
- if (ret)
+ if (ret) {
+ reset_control_assert(priv->reset);
return ret;
+ }

ret = devm_of_mdiobus_register(dev, bus, dev->of_node);
if (ret) {
--
2.34.1