Skip to content

Commit

Permalink
mlxsw: core: Fix an error handling path in 'mlxsw_core_bus_device_reg…
Browse files Browse the repository at this point in the history
…ister()'

Resources are not freed in the reverse order of the allocation.
Labels are also mixed-up.

Fix it and reorder code and labels in the error handling path of
'mlxsw_core_bus_device_register()'

Fixes: ef3116e ("mlxsw: spectrum: Register KVD resources with devlink")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christophe JAILLET authored and David S. Miller committed May 11, 2018
1 parent 89dd2e7 commit 8ccc113
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/mellanox/mlxsw/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,11 +1100,11 @@ int mlxsw_core_bus_device_register(const struct mlxsw_bus_info *mlxsw_bus_info,
err_alloc_lag_mapping:
mlxsw_ports_fini(mlxsw_core);
err_ports_init:
mlxsw_bus->fini(bus_priv);
err_bus_init:
if (!reload)
devlink_resources_unregister(devlink, NULL);
err_register_resources:
mlxsw_bus->fini(bus_priv);
err_bus_init:
if (!reload)
devlink_free(devlink);
err_devlink_alloc:
Expand Down

0 comments on commit 8ccc113

Please sign in to comment.