Skip to content

Commit dfcdb38

Browse files
zhuyjrleon
authored andcommitted
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>
1 parent c8fc935 commit dfcdb38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/infiniband/sw/rxe/rxe_pool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void rxe_pool_cleanup(struct rxe_pool *pool)
119119
int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem,
120120
bool sleepable)
121121
{
122-
int err;
122+
int err = -EINVAL;
123123
gfp_t gfp_flags;
124124

125125
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,
147147

148148
err_cnt:
149149
atomic_dec(&pool->num_elem);
150-
return -EINVAL;
150+
return err;
151151
}
152152

153153
void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)

0 commit comments

Comments
 (0)