Skip to content

Commit 26a80f6

Browse files
idoschdavem330
authored andcommitted
mlxsw: Call free_netdev when removing port
When removing a port's netdevice we should also free the memory allocated by alloc_etherdev(). Do this by calling free_netdev() at the end of the teardown sequence. Reported-by: Or Gerlitz <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ecea499 commit 26a80f6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/switchx2.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,7 @@ static void mlxsw_sx_port_remove(struct mlxsw_sx *mlxsw_sx, u8 local_port)
10791079
unregister_netdev(mlxsw_sx_port->dev); /* This calls ndo_stop */
10801080
mlxsw_sx_port_swid_set(mlxsw_sx_port, MLXSW_PORT_SWID_DISABLED_PORT);
10811081
free_percpu(mlxsw_sx_port->pcpu_stats);
1082+
free_netdev(mlxsw_sx_port->dev);
10821083
}
10831084

10841085
static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx)

0 commit comments

Comments
 (0)