Commit 15177999 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jason Gunthorpe

RDMA/mlx5: Don't leak UARs in case of free fails

The failure in releasing one UAR doesn't mean that we can't continue to
release rest of system pages, so don't return too early.

As part of cleanup, there is no need to print warning if
mlx5_cmd_free_uar() fails because such warning will be printed as part of
mlx5_cmd_exec().
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 4e1077f7
...@@ -1559,25 +1559,17 @@ static int allocate_uars(struct mlx5_ib_dev *dev, struct mlx5_ib_ucontext *conte ...@@ -1559,25 +1559,17 @@ static int allocate_uars(struct mlx5_ib_dev *dev, struct mlx5_ib_ucontext *conte
return err; return err;
} }
static int deallocate_uars(struct mlx5_ib_dev *dev, struct mlx5_ib_ucontext *context) static void deallocate_uars(struct mlx5_ib_dev *dev,
struct mlx5_ib_ucontext *context)
{ {
struct mlx5_bfreg_info *bfregi; struct mlx5_bfreg_info *bfregi;
int err;
int i; int i;
bfregi = &context->bfregi; bfregi = &context->bfregi;
for (i = 0; i < bfregi->num_sys_pages; i++) { for (i = 0; i < bfregi->num_sys_pages; i++)
if (i < bfregi->num_static_sys_pages || if (i < bfregi->num_static_sys_pages ||
bfregi->sys_pages[i] != MLX5_IB_INVALID_UAR_INDEX) { bfregi->sys_pages[i] != MLX5_IB_INVALID_UAR_INDEX)
err = mlx5_cmd_free_uar(dev->mdev, bfregi->sys_pages[i]); mlx5_cmd_free_uar(dev->mdev, bfregi->sys_pages[i]);
if (err) {
mlx5_ib_warn(dev, "failed to free uar %d, err=%d\n", i, err);
return err;
}
}
}
return 0;
} }
static int mlx5_ib_alloc_transport_domain(struct mlx5_ib_dev *dev, u32 *tdn) static int mlx5_ib_alloc_transport_domain(struct mlx5_ib_dev *dev, u32 *tdn)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment