Skip to contentSkip to conversation

net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources

PATCH Applied Miaoqian Lin 2 participants 2 messages Dec 22, 2021

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

PATCH 1/1 net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources

The mlx5_get_uars_page() function returns error pointers. Using IS_ERR() to check the return value to fix this.

Fixes 4ec9e7b02697("net/mlx5: DR, Expose steering domain functionality")
---
 drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c +3 -2
index 8cbd36c82b3b..f6e6d9209766 100644
@@ -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;
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · Miaoqian Lin

The mlx5_get_uars_page() function  returns error pointers. Using IS_ERR() to check the return value to fix this.

Fixes 4ec9e7b02697("net/mlx5: DR, Expose steering domain

functionality")

Applied to net-mlx5.

Thanks.