net: thunder_bgx: decrement cleanup index before use
Subsystems (3)
PATCH 1/1 net: thunder_bgx: decrement cleanup index before use
All paths in probe that call goto defer do so before assigning phydev and thus it makes sense to cleanup the prior index. It also fixes a bug where index 0 does not get cleaned up.
--- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +1 -1
@@ -1515,11 +1515,11 @@ static int bgx_init_of_phy(struct bgx *bgx)* for phy devices we may have already found. */ while (lmac) { + lmac--;if (bgx->lmac[lmac].phydev) {put_device (&bgx->lmac[lmac].phydev->mdio.dev); bgx->lmac[lmac].phydev =NULL ; } - lmac--; }of_node_put (node);return -EPROBE_DEFER ;
Signature · 1 line
2.51.0
Quoted 17 lines · Rosen Penev
All paths in probe that call goto defer do so before assigning phydev and thus it makes sense to cleanup the prior index. It also fixes a bug where index 0 does not get cleaned up.
Fixes b7d3e3d3d21a ("net: thunderx: Don't leak phy device references on -EPROBE_DEFER condition.")Signed-off-by Rosen Penev <[email protected]>--- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/cavium/thunder/thunder_bgx.c +0
-0@@ -1515,11 +1515,11 @@ static int bgx_init_of_phy(struct bgx *bgx)* for phy devices we may have already found. */
drivers/net/ethernet/cavium/thunder/thunder_bgx.c static int bgx_init_of_phy(struct bgx *bgx) · line 1525
Quoted 10 lines
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +1
-1while (lmac) { + lmac--;if (bgx->lmac[lmac].phydev) {put_device (&bgx->lmac[lmac].phydev->mdio.dev); bgx->lmac[lmac].phydev =NULL ; } - lmac--; }of_node_put (node);return -EPROBE_DEFER ;
Quoted 6 lines · Rosen Penev
All paths in probe that call goto defer do so before assigning phydev and thus it makes sense to cleanup the prior index. It also fixes a bug where index 0 does not get cleaned up.
Fixes b7d3e3d3d21a ("net: thunderx: Don't leak phy device references on -EPROBE_DEFER condition.")Signed-off-by Rosen Penev <[email protected]>
As I reviewed an earlier revision (yesterday)
where this was part of another patch:
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 8 lines · On Mon, 1 Sep 2025 14:33:14 -0700 you wrote:
All paths in probe that call goto defer do so before assigning phydev and thus it makes sense to cleanup the prior index. It also fixes a bug where index 0 does not get cleaned up.
Fixes b7d3e3d3d21a ("net: thunderx: Don't leak phy device references on -EPROBE_DEFER condition.")Signed-off-by Rosen Penev <[email protected]>[...]
Here is the summary with links:
- [net] net: thunder_bgx: decrement cleanup index before use
https://git.kernel.org/netdev/net/c/9e3d71a92e56
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html