History

net/mlx5: Fix error flow in case of function_setup failure

Currently, if an error occurred during mlx5_function_setup(), we keep dev->state as DEVICE_STATE_UP. Fixing it by adding a goto label.

Shay Drory committed 6 years ago

Commit 4f7400d1 parent d37bd5e1 file · +2 −1Browse files

Unified · Split

drivers/net/ethernet/mellanox/mlx5/core/main.c+2−1
@@ -1195,7 +1195,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) · 1194 unmodified lines
1195 1195
1196 err = mlx5_function_setup(dev, boot);1196 err = mlx5_function_setup(dev, boot);
1197 if (err)1197 if (err)
1198 goto out;1198 goto err_function;
1199 1199
1200 if (boot) {1200 if (boot) {
1201 err = mlx5_init_once(dev);1201 err = mlx5_init_once(dev);
@@ -1233,6 +1233,7 @@ err_load: · 31 unmodified lines
1233 mlx5_cleanup_once(dev);1233 mlx5_cleanup_once(dev);
1234function_teardown:1234function_teardown:
1235 mlx5_function_teardown(dev, boot);1235 mlx5_function_teardown(dev, boot);
1236err_function:
1236 dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;1237 dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
1237 mutex_unlock(&dev->intf_state_mutex);1238 mutex_unlock(&dev->intf_state_mutex);
1238 1239