netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Roi Dayan <roid@nvidia.com>,
	Miaoqian Lin <linmq006@gmail.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 01/11] net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources
Date: Wed, 22 Dec 2021 13:11:51 -0800	[thread overview]
Message-ID: <20211222211201.77469-2-saeed@kernel.org> (raw)
In-Reply-To: <20211222211201.77469-1-saeed@kernel.org>

From: Miaoqian Lin <linmq006@gmail.com>

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")
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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
index 8cbd36c82b3b..f6e6d9209766 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
@@ -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;
 	}
 
-- 
2.33.1


  reply	other threads:[~2021-12-22 21:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 21:11 [pull request][net 00/11] mlx5 fixes 2021-12-22 Saeed Mahameed
2021-12-22 21:11 ` Saeed Mahameed [this message]
2021-12-23  1:04   ` [net 01/11] net/mlx5: DR, Fix NULL vs IS_ERR checking in dr_domain_init_resources Jakub Kicinski
2021-12-23  1:09     ` Jakub Kicinski
2021-12-23  4:28       ` Saeed Mahameed
2021-12-22 21:11 ` [net 02/11] net/mlx5: DR, Fix querying eswitch manager vport for ECPF Saeed Mahameed
2021-12-22 21:11 ` [net 03/11] net/mlx5: Use first online CPU instead of hard coded CPU Saeed Mahameed
2021-12-22 21:11 ` [net 04/11] net/mlx5: Fix error print in case of IRQ request failed Saeed Mahameed
2021-12-22 21:11 ` [net 05/11] net/mlx5: Fix SF health recovery flow Saeed Mahameed
2021-12-22 21:11 ` [net 06/11] net/mlx5: Fix tc max supported prio for nic mode Saeed Mahameed
2021-12-22 21:11 ` [net 07/11] net/mlx5e: Wrap the tx reporter dump callback to extract the sq Saeed Mahameed
2021-12-22 21:11 ` [net 08/11] net/mlx5e: Fix skb memory leak when TC classifier action offloads are disabled Saeed Mahameed
2021-12-22 21:11 ` [net 09/11] net/mlx5e: Fix interoperability between XSK and ICOSQ recovery flow Saeed Mahameed
2021-12-22 21:12 ` [net 10/11] net/mlx5e: Fix ICOSQ recovery flow for XSK Saeed Mahameed
2021-12-22 21:12 ` [net 11/11] net/mlx5e: Delete forward rule for ct or sample action Saeed Mahameed
2021-12-23 10:31 ` [pull request][net 00/11] mlx5 fixes 2021-12-22 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211222211201.77469-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linmq006@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).