Skip to content

Commit 1869adf

Browse files
nehebopsiff
authored andcommitted
net: thunder_bgx: decrement cleanup index before use
[ Upstream commit 9e3d71a ] 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: b7d3e3d ("net: thunderx: Don't leak phy device references on -EPROBE_DEFER condition.") Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250901213314.48599-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit bee1e19cf1faa9bd0c7e298f8a643bc7ef65f068)
1 parent e209d33 commit 1869adf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/cavium/thunder/thunder_bgx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,11 +1517,11 @@ static int bgx_init_of_phy(struct bgx *bgx)
15171517
* for phy devices we may have already found.
15181518
*/
15191519
while (lmac) {
1520+
lmac--;
15201521
if (bgx->lmac[lmac].phydev) {
15211522
put_device(&bgx->lmac[lmac].phydev->mdio.dev);
15221523
bgx->lmac[lmac].phydev = NULL;
15231524
}
1524-
lmac--;
15251525
}
15261526
of_node_put(node);
15271527
return -EPROBE_DEFER;

0 commit comments

Comments
 (0)