Thread (10 messages) 10 messages, 6 authors, 2026-01-30

Re: [PATCH net-next 1/3] net: stmmac: rk: fix missing reset_control_put()

From: Philipp Zabel <p.zabel@pengutronix.de>
Date: 2026-01-28 12:04:41
Also in: linux-arm-kernel, linux-rockchip

On Mi, 2026-01-28 at 10:58 +0000, Russell King (Oracle) wrote:
quoted hunk ↗ jump to hunk
rk_gmac_setup() delves into the PHY's DT node to retrieve its reset
control using of_reset_control_get(). However, it never releases it
when the driver is removed. Add reset_control_put() to rk_gmac_exit()
to clean this up.

Signed-off-by: Russell King (Oracle) <redacted>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 5f8d2031b97c..bc69cbb5a7d4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1784,6 +1784,8 @@ static void rk_gmac_exit(struct device *dev, void *bsp_priv_)
 
 	if (priv->plat->phy_node && bsp_priv->integrated_phy)
 		clk_put(bsp_priv->clk_phy);
+
+	reset_control_put(bsp_priv->phy_reset);
 }
 
 static int rk_gmac_probe(struct platform_device *pdev)
This is fine because the driver sets plat_dat->suspend, and so
rk_gmac_exit() is never called via stmmac_pltfr_exit() during suspend.

It does look a bit sketchy to release resources in the rk_gmac_exit()
counterpart to rk_gmac_init(), which never requested the resources,
though. Maybe use devm_add_action_or_reset() to register the release of
the reset during remove?

regards
Philipp
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help