Skip to contentSkip to conversation

net: marvell: prestera: Fix a NULL vs IS_ERR() check in some functions

PATCH Applied Shang XiaoJing 2 participants 2 messages Nov 25, 2022 – Nov 29, 2022

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

PATCH 1/1 net: marvell: prestera: Fix a NULL vs IS_ERR() check in some functions

rhashtable_lookup_fast() returns NULL when failed instead of error pointer.

Fixes 396b80cb5cc8 ("net: marvell: prestera: Add neighbour cache accounting")
Fixes 0a23ae237171 ("net: marvell: prestera: Add router nexthops ABI")
---
 drivers/net/ethernet/marvell/prestera/prestera_router.c    | 2 +-
 drivers/net/ethernet/marvell/prestera/prestera_router_hw.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/prestera/prestera_router.c +1 -1
index 4046be0e86ff..a9a1028cb17b 100644
@@ -457,7 +457,7 @@ prestera_kern_neigh_cache_find(struct prestera_switch *sw,
 	n_cache =
 	 rhashtable_lookup_fast(&sw->router->kern_neigh_cache_ht, key,
 				__prestera_kern_neigh_cache_ht_params);
-	return IS_ERR(n_cache) ? NULL : n_cache;
+	return n_cache;
 }
 
 static void
drivers/net/ethernet/marvell/prestera/prestera_router_hw.c +2 -2
index aa080dc57ff0..02faaea2aefa 100644
@@ -330,7 +330,7 @@ prestera_nh_neigh_find(struct prestera_switch *sw,
 
 	nh_neigh = rhashtable_lookup_fast(&sw->router->nh_neigh_ht,
 					  key, __prestera_nh_neigh_ht_params);
-	return IS_ERR(nh_neigh) ? NULL : nh_neigh;
+	return nh_neigh;
 }
 
 struct prestera_nh_neigh *
@@ -484,7 +484,7 @@ __prestera_nexthop_group_find(struct prestera_switch *sw,
 
 	nh_grp = rhashtable_lookup_fast(&sw->router->nexthop_group_ht,
 					key, __prestera_nexthop_group_ht_params);
-	return IS_ERR(nh_grp) ? NULL : nh_grp;
+	return nh_grp;
 }
 
 static struct prestera_nexthop_group *
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Fri, 25 Nov 2022 09:27:51 +0800 you wrote:

rhashtable_lookup_fast() returns NULL when failed instead of error pointer.

Fixes 396b80cb5cc8 ("net: marvell: prestera: Add neighbour cache accounting")
Fixes 0a23ae237171 ("net: marvell: prestera: Add router nexthops ABI")

[...]

Here is the summary with links:
- net: marvell: prestera: Fix a NULL vs IS_ERR() check in some functions

    https://git.kernel.org/netdev/net/c/e493bec343fa

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html