Commit 49be1e24 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski
Browse files

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: 96619c48 ("net/mlx5: Add support for setting tc-bw on nodes")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/0ce4ec2a-2b5d-4652-9638-e715a99902a7@sabinyo.mountain


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c2fe3b2a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;
}