Currently, if an error occurred during mlx5_function_setup(), we keep dev->state as DEVICE_STATE_UP. Fixing it by adding a goto label.
Unified · Split
| @@ -1195,7 +1195,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) · 1194 unmodified lines | ||
| 1195 | 1195 | |
| 1196 | 1196 | err = mlx5_function_setup(dev, boot); |
| 1197 | 1197 | if (err) |
| 1198 | − goto out; | |
| 1198 | + goto err_function; | |
| 1199 | 1199 | |
| 1200 | 1200 | if (boot) { |
| 1201 | 1201 | err = mlx5_init_once(dev); |
| @@ -1233,6 +1233,7 @@ err_load: · 31 unmodified lines | ||
| 1233 | 1233 | mlx5_cleanup_once(dev); |
| 1234 | 1234 | function_teardown: |
| 1235 | 1235 | mlx5_function_teardown(dev, boot); |
| 1236 | +err_function: | |
| 1236 | 1237 | dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; |
| 1237 | 1238 | mutex_unlock(&dev->intf_state_mutex); |
| 1238 | 1239 | |