diff options
author | Zhu Yanjun <yanjun.zhu@linux.dev> | 2024-04-08 16:21:42 +0200 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2024-04-11 13:47:26 +0200 |
commit | dfcdb38b21e4fb92a49acdbdf6afa82c07c8eba0 (patch) | |
tree | 91c261e8f17b72601f78e32b82d10af94e1b70c6 /drivers/infiniband/sw/rxe/rxe_pool.c | |
parent | RDMA/mana_ib: remove useless return values from dbg prints (diff) | |
download | linux-dfcdb38b21e4fb92a49acdbdf6afa82c07c8eba0.tar.xz linux-dfcdb38b21e4fb92a49acdbdf6afa82c07c8eba0.zip |
RDMA/rxe: Return the correct errno
In the function __rxe_add_to_pool, the function xa_alloc_cyclic is
called. The return value of the function xa_alloc_cyclic is as below:
"
Return: 0 if the allocation succeeded without wrapping. 1 if the
allocation succeeded after wrapping, -ENOMEM if memory could not be
allocated or -EBUSY if there are no free entries in @limit.
"
But now the function __rxe_add_to_pool only returns -EINVAL. All the
returned error value should be returned to the caller.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Link: https://lore.kernel.org/r/20240408142142.792413-1-yanjun.zhu@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_pool.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c index 6215c6de3a84..67567d62195e 100644 --- a/drivers/infiniband/sw/rxe/rxe_pool.c +++ b/drivers/infiniband/sw/rxe/rxe_pool.c @@ -119,7 +119,7 @@ void rxe_pool_cleanup(struct rxe_pool *pool) int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem, bool sleepable) { - int err; + int err = -EINVAL; gfp_t gfp_flags; if (atomic_inc_return(&pool->num_elem) > pool->max_elem) @@ -147,7 +147,7 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem, err_cnt: atomic_dec(&pool->num_elem); - return -EINVAL; + return err; } void *rxe_pool_get_index(struct rxe_pool *pool, u32 index) |