Skip to contentSkip to conversation

net/mlx5e: TC, fix return value check in mlx5e_tc_act_stats_create()

PATCH In review Yang Yingliang 2 participants 2 messages Feb 17, 2023 – Feb 19, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5e: TC, fix return value check in mlx5e_tc_act_stats_create()

kvzalloc() returns NULL pointer not PTR_ERR() when it fails, so replace the IS_ERR() check with NULL pointer check.

Fixes d13674b1d14c ("net/mlx5e: TC, map tc action cookie to a hw counter")
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c +1 -1
index f71766dca660..626cb7470fa5 100644
@@ -37,7 +37,7 @@ mlx5e_tc_act_stats_create(void)
 	int err;
 
 	handle = kvzalloc(sizeof(*handle), GFP_KERNEL);
-	if (IS_ERR(handle))
+	if (!handle)
 		return ERR_PTR(-ENOMEM);
 
 	err = rhashtable_init(&handle->ht, &act_counters_ht_params);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Yang Yingliang

kvzalloc() returns NULL pointer not PTR_ERR() when it fails, so replace the IS_ERR() check with NULL pointer check.

Fixes d13674b1d14c ("net/mlx5e: TC, map tc action cookie to a hw counter")
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c +0 -0
index f71766dca660..626cb7470fa5 100644

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c mlx5e_tc_act_stats_create(void) · line 43

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c +1 -1
@@ -37,7 +37,7 @@ mlx5e_tc_act_stats_create(void)
 	int err;
 
 	handle = kvzalloc(sizeof(*handle), GFP_KERNEL);
-	if (IS_ERR(handle))
+	if (!handle)
 		return ERR_PTR(-ENOMEM);
 
 	err = rhashtable_init(&handle->ht, &act_counters_ht_params);

thanks