Skip to content

Commit

Permalink
net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources
Browse files Browse the repository at this point in the history
The mlx5_get_uars_page() function  returns error pointers.
Using IS_ERR() to check the return value to fix this.

Fixes: 4ec9e7b ("net/mlx5: DR, Expose steering domain functionality")
Signed-off-by: Miaoqian Lin <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
  • Loading branch information
Yuuoniy authored and Saeed Mahameed committed Dec 23, 2021
1 parent d1652b7 commit 6b8b425
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 6b8b425

Please sign in to comment.