Skip to contentSkip to conversation

net: thunder_bgx: add a missing of_node_put

PATCH Applied Rosen Penev 3 participants 3 messages Sep 1, 2025 – Sep 4, 2025

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

PATCH 1/1 net: thunder_bgx: add a missing of_node_put

phy_np needs to get freed, just like the other child nodes.

Fixes 5fc7cf179449 ("net: thunderx: Cleanup PHY probing code.")
---
 .../net/ethernet/cavium/thunder/thunder_bgx.c  | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +11 -7
index 90c718af06c1..9efb60842ad1 100644
@@ -1493,13 +1493,17 @@ static int bgx_init_of_phy(struct bgx *bgx)
 		 * this cortina phy, for which there is no driver
 		 * support, ignore it.
 		 */
-		if (phy_np &&
-		    !of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
-			/* Wait until the phy drivers are available */
-			pd = of_phy_find_device(phy_np);
-			if (!pd)
-				goto defer;
-			bgx->lmac[lmac].phydev = pd;
+		if (phy_np) {
+			if (!of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
+				/* Wait until the phy drivers are available */
+				pd = of_phy_find_device(phy_np);
+				if (!pd) {
+					of_node_put(phy_np);
+					goto defer;
+				}
+				bgx->lmac[lmac].phydev = pd;
+			}
+			of_node_put(phy_np);
 		}
 
 		lmac++;
Signature · 1 line
2.51.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Rosen Penev

phy_np needs to get freed, just like the other child nodes.

Fixes 5fc7cf179449 ("net: thunderx: Cleanup PHY probing code.")

I wonder if this leak has existed since commit 4863dea3fab0 ("net: Adding support for Cavium ThunderX network controller")

Quoted 1 line

Otherwise, LGTM.

#2 lore raw
In reply to Rosen Penev
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 7 lines · On Mon, 1 Sep 2025 14:30:18 -0700 you wrote:

phy_np needs to get freed, just like the other child nodes.

Fixes 5fc7cf179449 ("net: thunderx: Cleanup PHY probing code.")
---
 .../net/ethernet/cavium/thunder/thunder_bgx.c  | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Here is the summary with links:
- net: thunder_bgx: add a missing of_node_put

    https://git.kernel.org/netdev/net/c/9d28f9491258

You are awesome, thank you!

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