netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <kuba@kernel.org>, <davem@davemloft.net>, <tchornyi@marvell.com>,
	<yevhen.orlov@plvision.eu>
Subject: [PATCH net-next 1/2] net: marvell: prestera: Fix return value check in prestera_fib_node_find()
Date: Wed, 23 Feb 2022 16:49:53 +0800	[thread overview]
Message-ID: <20220223084954.1771075-1-yangyingliang@huawei.com> (raw)

rhashtable_lookup_fast() returns NULL pointer not ERR_PTR(), so
it can return fib_node directly in prestera_fib_node_find().

Fixes: 16de3db1208a ("net: marvell: prestera: add hardware router objects accounting for lpm")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/marvell/prestera/prestera_router_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
index d62adb970dd5..5b0cf3be9a9e 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c
@@ -239,7 +239,7 @@ prestera_fib_node_find(struct prestera_switch *sw, struct prestera_fib_key *key)
 
 	fib_node = rhashtable_lookup_fast(&sw->router->fib_ht, key,
 					  __prestera_fib_ht_params);
-	return IS_ERR(fib_node) ? NULL : fib_node;
+	return fib_node;
 }
 
 static void __prestera_fib_node_destruct(struct prestera_switch *sw,
-- 
2.25.1


             reply	other threads:[~2022-02-23  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23  8:49 Yang Yingliang [this message]
2022-02-23  8:49 ` [PATCH net-next 2/2] net: marvell: prestera: Fix return value check in prestera_kern_fib_cache_find() Yang Yingliang
2022-02-25  5:30 ` [PATCH net-next 1/2] net: marvell: prestera: Fix return value check in prestera_fib_node_find() patchwork-bot+netdevbpf

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=20220223084954.1771075-1-yangyingliang@huawei.com \
    --to=yangyingliang@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tchornyi@marvell.com \
    --cc=yevhen.orlov@plvision.eu \
    /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).