net/mlx5e: TC, fix return value check in mlx5e_tc_act_stats_create()
Subsystems (4)
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")
Signed-off-by Yang Yingliang <[email protected]>
--- 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
@@ -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
Quoted 14 lines · Yang Yingliang
kvzalloc()returns NULL pointer notPTR_ERR()when it fails, so replace theIS_ERR()check with NULL pointer check.Fixes d13674b1d14c ("net/mlx5e: TC, map tc action cookie to a hw counter")Signed-off-by Yang Yingliang <[email protected]>--- 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
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
Reviewed-by Roi Dayan <[email protected]>