From: Ido Schimmel Date: Fri, 26 Feb 2016 16:32:30 +0000 (+0100) Subject: mlxsw: spectrum: Mark unused ports using NULL X-Git-Tag: pci-v4.6-fixes-1~25^2~162^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a133318cde2000a3264032ea3b561c9054613486;p=users%2Fdwmw2%2Flinux.git mlxsw: spectrum: Mark unused ports using NULL When splitting and unsplitting we'll destroy usable ports on the fly, so mark them using a NULL pointer to indicate that their local port number is free and can be re-used. Signed-off-by: Ido Schimmel Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 240881c8dec27..926019e86c36a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1518,6 +1518,7 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port) if (!mlxsw_sp_port) return; + mlxsw_sp->ports[local_port] = NULL; devlink_port = &mlxsw_sp_port->devlink_port; devlink_port_type_clear(devlink_port); unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */