Skip to contentSkip to conversation

net: dsa: Add missing of_node_put() in dsa_port_link_register_of

PATCH Applied Miaoqian Lin 2 participants 2 messages Apr 20, 2022 – Apr 22, 2022

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

PATCH 1/1 net: dsa: Add missing of_node_put() in dsa_port_link_register_of

The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. of_node_put() will check for NULL value.

Fixes a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed")
---
 net/dsa/port.c | 2 ++
 1 file changed, 2 insertions(+)
net/dsa/port.c +2 -0
index 32d472a82241..cdc56ba11f52 100644
@@ -1620,8 +1620,10 @@ int dsa_port_link_register_of(struct dsa_port *dp)
 			if (ds->ops->phylink_mac_link_down)
 				ds->ops->phylink_mac_link_down(ds, port,
 					MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
+			of_node_put(phy_np);
 			return dsa_port_phylink_register(dp);
 		}
+		of_node_put(phy_np);
 		return 0;
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Wed, 20 Apr 2022 19:04:08 +0800 you wrote:

The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. of_node_put() will check for NULL value.

Fixes a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed")

[...]

Here is the summary with links:
- net: dsa: Add missing of_node_put() in dsa_port_link_register_of

    https://git.kernel.org/netdev/net/c/fc06b2867f4c

You are awesome, thank you!

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