net/mlx5: Release devlink object if adev fails

Add missed freeing previously allocated devlink object.

Fixes: a925b5e309 ("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>
This commit is contained in:
Leon Romanovsky 2021-01-04 10:08:36 +02:00 committed by Saeed Mahameed
parent b1c0aca3d3
commit 4d8be21112

View File

@ -1368,8 +1368,10 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *id)
MLX5_COREDEV_VF : MLX5_COREDEV_PF; MLX5_COREDEV_VF : MLX5_COREDEV_PF;
dev->priv.adev_idx = mlx5_adev_idx_alloc(); dev->priv.adev_idx = mlx5_adev_idx_alloc();
if (dev->priv.adev_idx < 0) if (dev->priv.adev_idx < 0) {
return dev->priv.adev_idx; err = dev->priv.adev_idx;
goto adev_init_err;
}
err = mlx5_mdev_init(dev, prof_sel); err = mlx5_mdev_init(dev, prof_sel);
if (err) if (err)
@ -1403,6 +1405,7 @@ pci_init_err:
mlx5_mdev_uninit(dev); mlx5_mdev_uninit(dev);
mdev_init_err: mdev_init_err:
mlx5_adev_idx_free(dev->priv.adev_idx); mlx5_adev_idx_free(dev->priv.adev_idx);
adev_init_err:
mlx5_devlink_free(devlink); mlx5_devlink_free(devlink);
return err; return err;