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
11951195
11961196 err = mlx5_function_setup(dev, boot);
11971197 if (err)
1198− goto out;
1198+ goto err_function;
11991199
12001200 if (boot) {
12011201 err = mlx5_init_once(dev);
@@ -1233,6 +1233,7 @@ err_load: · 31 unmodified lines
12331233 mlx5_cleanup_once(dev);
12341234 function_teardown:
12351235 mlx5_function_teardown(dev, boot);
1236+err_function:
12361237 dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
12371238 mutex_unlock(&dev->intf_state_mutex);
12381239