net/mlx5: HWS, Set the num of queues only when alloc succeeded

When initializing send queues, set the number of queues only
when allocations are over.

Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260816142045.3289452-4-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Yevgeny Kliteynik 2026-08-16 17:20:43 +03:00 committed by Jakub Kicinski
parent d4c34eebf1
commit 5d3ff6671b

View File

@ -1116,8 +1116,6 @@ static int hws_bwc_send_queues_init(struct mlx5hws_context *ctx)
if (!mlx5hws_context_bwc_supported(ctx))
return 0;
ctx->queues += bwc_queues;
ctx->bwc_send_queue_locks = kzalloc_objs(*ctx->bwc_send_queue_locks,
bwc_queues);
@ -1129,6 +1127,8 @@ static int hws_bwc_send_queues_init(struct mlx5hws_context *ctx)
if (!ctx->bwc_lock_class_keys)
goto err_lock_class_keys;
ctx->queues += bwc_queues;
for (i = 0; i < bwc_queues; i++) {
mutex_init(&ctx->bwc_send_queue_locks[i]);
lockdep_register_key(ctx->bwc_lock_class_keys + i);