Skip to content

Commit 0583272

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Add missing rollbacks in error path
While going over the code I noticed we are missing two rollbacks in the port's creation error path. Add them and adjust the place of one of them in the port's removal sequence so that both are symmetric. Fixes: 56ade8f ("mlxsw: spectrum: Add initial support for Spectrum ASIC") 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>
1 parent 0e7df1a commit 0583272

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
22062206
unregister_netdev(dev);
22072207
err_register_netdev:
22082208
mlxsw_sp->ports[local_port] = NULL;
2209+
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
22092210
mlxsw_sp_port_pvid_vport_destroy(mlxsw_sp_port);
22102211
err_port_pvid_vport_create:
22112212
mlxsw_sp_port_dcb_fini(mlxsw_sp_port);
@@ -2215,6 +2216,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
22152216
err_port_admin_status_set:
22162217
err_port_mtu_set:
22172218
err_port_speed_by_width_set:
2219+
mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT);
22182220
err_port_swid_set:
22192221
err_port_system_port_mapping_set:
22202222
err_dev_addr_init:
@@ -2237,9 +2239,9 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u8 local_port)
22372239
mlxsw_core_port_fini(&mlxsw_sp_port->core_port);
22382240
unregister_netdev(mlxsw_sp_port->dev); /* This calls ndo_stop */
22392241
mlxsw_sp->ports[local_port] = NULL;
2242+
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
22402243
mlxsw_sp_port_pvid_vport_destroy(mlxsw_sp_port);
22412244
mlxsw_sp_port_dcb_fini(mlxsw_sp_port);
2242-
mlxsw_sp_port_switchdev_fini(mlxsw_sp_port);
22432245
mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT);
22442246
mlxsw_sp_port_module_unmap(mlxsw_sp, mlxsw_sp_port->local_port);
22452247
free_percpu(mlxsw_sp_port->pcpu_stats);

0 commit comments

Comments
 (0)