OSDN Git Service

net/mlx5e: TC, fix return value check in mlx5e_tc_act_stats_create()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 17 Feb 2023 03:13:01 +0000 (11:13 +0800)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 24 Feb 2023 18:13:18 +0000 (10:13 -0800)
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 <yangyingliang@huawei.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c

index f71766d..626cb74 100644 (file)
@@ -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);