net/mlx5: Have single error unwinding path
authorParav Pandit <parav@mellanox.com>
Fri, 1 May 2020 15:20:01 +0000 (10:20 -0500)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 15 May 2020 22:44:17 +0000 (15:44 -0700)
Having multiple error unwinding path are error prone.
Lets have just one error unwinding path.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/main.c

index 742ba01..2e12806 100644 (file)
@@ -1217,10 +1217,9 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
                mlx5_register_device(dev);
 
        set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
-out:
-       mutex_unlock(&dev->intf_state_mutex);
 
-       return err;
+       mutex_unlock(&dev->intf_state_mutex);
+       return 0;
 
 err_devlink_reg:
        mlx5_unload(dev);
@@ -1230,8 +1229,8 @@ err_load:
 function_teardown:
        mlx5_function_teardown(dev, boot);
        dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
+out:
        mutex_unlock(&dev->intf_state_mutex);
-
        return err;
 }