mlxsw: Call free_netdev when removing port
authorIdo Schimmel <idosch@mellanox.com>
Thu, 6 Aug 2015 14:41:52 +0000 (16:41 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Aug 2015 05:54:09 +0000 (22:54 -0700)
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 <ogerlitz@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/switchx2.c

index 29b46eef97692804b1a6e1ef142a2d77962668db..687f5cbef25bbcb017679b6007b64c830c28617f 100644 (file)
@@ -1079,6 +1079,7 @@ static void mlxsw_sx_port_remove(struct mlxsw_sx *mlxsw_sx, u8 local_port)
        unregister_netdev(mlxsw_sx_port->dev); /* This calls ndo_stop */
        mlxsw_sx_port_swid_set(mlxsw_sx_port, MLXSW_PORT_SWID_DISABLED_PORT);
        free_percpu(mlxsw_sx_port->pcpu_stats);
+       free_netdev(mlxsw_sx_port->dev);
 }
 
 static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx)