RDMA/mlx5: Fix memory leak in case we fail to add an IB device
Make sure the IB device is freed on failure.
Fixes: b5ca15ad7e
("IB/mlx5: Add proper representors support")
Signed-off-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Reviewed-by: Håkon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
0da4d48d99
commit
fc9e4477f9
|
@ -78,8 +78,10 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
|
|||
ibdev->mdev = dev;
|
||||
ibdev->num_ports = max(MLX5_CAP_GEN(dev, num_ports),
|
||||
MLX5_CAP_GEN(dev, num_vhca_ports));
|
||||
if (!__mlx5_ib_add(ibdev, &rep_profile))
|
||||
if (!__mlx5_ib_add(ibdev, &rep_profile)) {
|
||||
ib_dealloc_device(&ibdev->ib_dev);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rep->rep_if[REP_IB].priv = ibdev;
|
||||
|
||||
|
|
Loading…
Reference in New Issue