net/mlx5: Fix an IS_ERR() vs NULL bug in esw_qos_move_node()

The __esw_qos_alloc_node() function returns NULL on error.  It doesn't
return error pointers.  Update the error checking to match.

Fixes: 96619c485f ("net/mlx5: Add support for setting tc-bw on nodes")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/0ce4ec2a-2b5d-4652-9638-e715a99902a7@sabinyo.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Dan Carpenter 2025-07-15 18:01:30 -05:00 committed by Jakub Kicinski
parent c2fe3b2a7c
commit 49be1e245e

View File

@ -1405,9 +1405,10 @@ esw_qos_move_node(struct mlx5_esw_sched_node *curr_node)
new_node = __esw_qos_alloc_node(curr_node->esw, curr_node->ix,
curr_node->type, NULL);
if (!IS_ERR(new_node))
esw_qos_nodes_set_parent(&curr_node->children, new_node);
if (!new_node)
return ERR_PTR(-ENOMEM);
esw_qos_nodes_set_parent(&curr_node->children, new_node);
return new_node;
}