From: Dan Carpenter Date: Thu, 4 Aug 2022 14:39:31 +0000 (+0300) Subject: net/mlx5: Unlock on error in mlx5_sriov_enable() X-Git-Tag: baikal/aarch64/sdk6.1~3197^2~13^2 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=bebc70122b3b3092522318ad6d7931f232ef4ef8;p=kernel.git net/mlx5: Unlock on error in mlx5_sriov_enable() Unlock before returning if mlx5_device_enable_sriov() fails. Fixes: 9c47dc56b543 ("net/mlx5: Lock mlx5 devlink reload callbacks") Signed-off-by: Dan Carpenter Signed-off-by: Saeed Mahameed --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c index ee2e1b7c1310d..c0e6c487c63c1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/sriov.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sriov.c @@ -159,11 +159,11 @@ static int mlx5_sriov_enable(struct pci_dev *pdev, int num_vfs) devl_lock(devlink); err = mlx5_device_enable_sriov(dev, num_vfs); + devl_unlock(devlink); if (err) { mlx5_core_warn(dev, "mlx5_device_enable_sriov failed : %d\n", err); return err; } - devl_unlock(devlink); err = pci_enable_sriov(pdev, num_vfs); if (err) {