mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 08:39:08 -04:00
net/mlx5: HWS, handle returned error value in pool alloc
Handle all negative return values as errors, not just -1. The code previously treated -ENOMEM (and potentially other negative values) as valid segment numbers, leading to incorrect behavior. This fix ensures that any negative return value is treated as an error. Signed-off-by: Vlad Dogaru <vdogaru@nvidia.com> Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20250102181415.1477316-13-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
be482f1d10
commit
a105db854c
@@ -183,7 +183,7 @@ static int hws_pool_buddy_get_mem_chunk(struct mlx5hws_pool *pool,
|
||||
*seg = -1;
|
||||
|
||||
/* Find the next free place from the buddy array */
|
||||
while (*seg == -1) {
|
||||
while (*seg < 0) {
|
||||
for (i = 0; i < MLX5HWS_POOL_RESOURCE_ARR_SZ; i++) {
|
||||
buddy = hws_pool_buddy_get_next_buddy(pool, i,
|
||||
order,
|
||||
@@ -194,7 +194,7 @@ static int hws_pool_buddy_get_mem_chunk(struct mlx5hws_pool *pool,
|
||||
}
|
||||
|
||||
*seg = mlx5hws_buddy_alloc_mem(buddy, order);
|
||||
if (*seg != -1)
|
||||
if (*seg >= 0)
|
||||
goto found;
|
||||
|
||||
if (pool->flags & MLX5HWS_POOL_FLAGS_ONE_RESOURCE) {
|
||||
|
||||
Reference in New Issue
Block a user