Commit e493bec3 authored by Shang XiaoJing's avatar Shang XiaoJing Committed by Paolo Abeni

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: 396b80cb ("net: marvell: prestera: Add neighbour cache accounting")
Fixes: 0a23ae23 ("net: marvell: prestera: Add router nexthops ABI")
Signed-off-by: default avatarShang XiaoJing <shangxiaojing@huawei.com>
Link: https://lore.kernel.org/r/20221125012751.23249-1-shangxiaojing@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 5daadc86
...@@ -457,7 +457,7 @@ prestera_kern_neigh_cache_find(struct prestera_switch *sw, ...@@ -457,7 +457,7 @@ prestera_kern_neigh_cache_find(struct prestera_switch *sw,
n_cache = n_cache =
rhashtable_lookup_fast(&sw->router->kern_neigh_cache_ht, key, rhashtable_lookup_fast(&sw->router->kern_neigh_cache_ht, key,
__prestera_kern_neigh_cache_ht_params); __prestera_kern_neigh_cache_ht_params);
return IS_ERR(n_cache) ? NULL : n_cache; return n_cache;
} }
static void static void
......
...@@ -330,7 +330,7 @@ prestera_nh_neigh_find(struct prestera_switch *sw, ...@@ -330,7 +330,7 @@ prestera_nh_neigh_find(struct prestera_switch *sw,
nh_neigh = rhashtable_lookup_fast(&sw->router->nh_neigh_ht, nh_neigh = rhashtable_lookup_fast(&sw->router->nh_neigh_ht,
key, __prestera_nh_neigh_ht_params); key, __prestera_nh_neigh_ht_params);
return IS_ERR(nh_neigh) ? NULL : nh_neigh; return nh_neigh;
} }
struct prestera_nh_neigh * struct prestera_nh_neigh *
...@@ -484,7 +484,7 @@ __prestera_nexthop_group_find(struct prestera_switch *sw, ...@@ -484,7 +484,7 @@ __prestera_nexthop_group_find(struct prestera_switch *sw,
nh_grp = rhashtable_lookup_fast(&sw->router->nexthop_group_ht, nh_grp = rhashtable_lookup_fast(&sw->router->nexthop_group_ht,
key, __prestera_nexthop_group_ht_params); key, __prestera_nexthop_group_ht_params);
return IS_ERR(nh_grp) ? NULL : nh_grp; return nh_grp;
} }
static struct prestera_nexthop_group * static struct prestera_nexthop_group *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment