summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2021-01-04 10:08:36 +0200
committerSaeed Mahameed <saeedm@nvidia.com>2021-01-07 12:22:50 -0800
commit4d8be21112f6fa2ac4b8a13f35866ad65b11d48c (patch)
treea4e3b55bc2519aae8bccd6a678cfbbe4616dd672 /drivers/net
parentb1c0aca3d3ddeebeec57ada9c2df9ed647939249 (diff)
downloadlinux-4d8be21112f6fa2ac4b8a13f35866ad65b11d48c.tar.gz
linux-4d8be21112f6fa2ac4b8a13f35866ad65b11d48c.tar.bz2
linux-4d8be21112f6fa2ac4b8a13f35866ad65b11d48c.zip
net/mlx5: Release devlink object if adev fails
Add missed freeing previously allocated devlink object. Fixes: a925b5e309c9 ("net/mlx5: Register mlx5 devices to auxiliary virtual bus") Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index c08315b51fd3..ca6f2fc39ea0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1368,8 +1368,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id)
MLX5_COREDEV_VF : MLX5_COREDEV_PF;
dev->priv.adev_idx = mlx5_adev_idx_alloc();
- if (dev->priv.adev_idx < 0)
- return dev->priv.adev_idx;
+ if (dev->priv.adev_idx < 0) {
+ err = dev->priv.adev_idx;
+ goto adev_init_err;
+ }
err = mlx5_mdev_init(dev, prof_sel);
if (err)
@@ -1403,6 +1405,7 @@ pci_init_err:
mlx5_mdev_uninit(dev);
mdev_init_err:
mlx5_adev_idx_free(dev->priv.adev_idx);
+adev_init_err:
mlx5_devlink_free(devlink);
return err;