Skip to contentSkip to conversation

tsnep: Add missing of_node_put() in tsnep_mdio_init()

PATCH Applied Yang Yingliang 2 participants 2 messages Nov 24, 2021 – Nov 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tsnep: Add missing of_node_put() in tsnep_mdio_init()

The node pointer is returned by of_get_child_by_name() with refcount incremented in tsnep_mdio_init(). Calling of_node_put() to aovid the refcount leak in tsnep_mdio_init().

---
 drivers/net/ethernet/engleder/tsnep_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/engleder/tsnep_main.c +2 -1
index 8333313dd706..d7d436d6aed2 100644
@@ -1089,9 +1089,10 @@ static int tsnep_mdio_init(struct tsnep_adapter *adapter)
 	adapter->mdiobus->phy_mask = 0x0000001;
 
 	retval = of_mdiobus_register(adapter->mdiobus, np);
+
+out:
 	if (np)
 		of_node_put(np);
-out:
 
 	return retval;
 }
Signature · 1 line
2.25.1
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 24 Nov 2021 16:40:48 +0800 you wrote:

The node pointer is returned by of_get_child_by_name() with refcount incremented in tsnep_mdio_init(). Calling of_node_put() to aovid the refcount leak in tsnep_mdio_init().

[...]

Here is the summary with links:
- [-next] tsnep: Add missing of_node_put() in tsnep_mdio_init()

    https://git.kernel.org/netdev/net-next/c/739752d655b3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html