net: stmmac: rk: put the PHY clock on remove
Subsystems (5)
PATCH v2 1/1 net: stmmac: rk: put the PHY clock on remove
The PHY clock (bsp_priv->clk_phy) is obtained using of_clk_get(), which doesn't take part in the devm release. Therefore, when a device is unbound, this clock needs to be explicitly put. Fix this.
---
Spotted this resource leak while making other changes to dwmac-rk. Would be great if the dwmac-rk maintainers can test it.
v2: fix build error
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +5 -1
@@ -1765,11 +1765,15 @@ static int rk_gmac_probe(struct platform_device *pdev)static void rk_gmac_remove (struct platform_device *pdev) { -struct rk_priv_data *bsp_priv =get_stmmac_bsp_priv (&pdev->dev); +struct stmmac_priv *priv =netdev_priv (platform_get_drvdata (pdev)); +struct rk_priv_data *bsp_priv = priv->plat->bsp_priv;stmmac_dvr_remove (&pdev->dev);rk_gmac_powerdown (bsp_priv); + +if (priv->plat->phy_node && bsp_priv->integrated_phy) +clk_put (bsp_priv->clk_phy); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.30.2
Quoted 10 lines · Russell King (Oracle)
The PHY clock (
bsp_priv->clk_phy) is obtained usingof_clk_get(), which doesn't take part in the devm release. Therefore, when a device is unbound, this clock needs to be explicitly put. Fix this.Signed-off-by Russell King (Oracle) <[email protected]>---
Spotted this resource leak while making other changes to dwmac-rk. Would be great if the dwmac-rk maintainers can test it.v2: fix build error
Thanks for the update Russell.
This fix looks good to me.
And I guess it ought to be marked with.
If correct, then I don't think any further action is required as supplying tags via email should be sufficient.
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 08 Aug 2025 13:16:34 +0100 you wrote:
The PHY clock (
bsp_priv->clk_phy) is obtained usingof_clk_get(), which doesn't take part in the devm release. Therefore, when a device is unbound, this clock needs to be explicitly put. Fix this.Signed-off-by Russell King (Oracle) <[email protected]>---
Spotted this resource leak while making other changes to dwmac-rk. Would be great if the dwmac-rk maintainers can test it.[...]
Here is the summary with links:
- [net,v2] net: stmmac: rk: put the PHY clock on remove
https://git.kernel.org/netdev/net/c/de1e963ad064
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html