]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources
authorMiaoqian Lin <linmq006@gmail.com>
Wed, 22 Dec 2021 06:54:53 +0000 (06:54 +0000)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 23 Dec 2021 04:38:46 +0000 (20:38 -0800)
The mlx5_get_uars_page() function  returns error pointers.
Using IS_ERR() to check the return value to fix this.

Fixes: 00a2ba0e66f8 ("net/mlx5: DR, Expose steering domain functionality")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c

index 8cbd36c82b3b82a84f49fa93c3109e5ea65b80ad..f6e6d92097661306a8f9b0558e23abd7dbb0654d 100644 (file)
@@ -2,6 +2,7 @@
 /* Copyright (c) 2019 Mellanox Technologies. */
 
 #include <linux/mlx5/eswitch.h>
+#include <linux/err.h>
 #include "dr_types.h"
 
 #define DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, dmn_type) \
@@ -72,9 +73,9 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn)
        }
 
        dmn->uar = mlx5_get_uars_page(dmn->mdev);
-       if (!dmn->uar) {
+       if (IS_ERR(dmn->uar)) {
                mlx5dr_err(dmn, "Couldn't allocate UAR\n");
-               ret = -ENOMEM;
+               ret = PTR_ERR(dmn->uar);
                goto clean_pd;
        }