net: marvell: prestera: fix a couple NULL vs IS_ERR() checks
PATCH 1/1 net: marvell: prestera: fix a couple NULL vs IS_ERR() checks
The __prestera_nexthop_group_create() function returns NULL on error and the prestera_nexthop_group_get() returns error pointers. Fix these two checks.
Fixes 0a23ae237171 ("net: marvell: prestera: Add router nexthops ABI")
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/net/ethernet/marvell/prestera/prestera_router_hw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/prestera/prestera_router_hw.c +3 -3
@@ -498,8 +498,8 @@ prestera_nexthop_group_get(struct prestera_switch *sw,refcount_inc (&nh_grp->refcount); }else { nh_grp =__prestera_nexthop_group_create (sw, key); -if (IS_ERR (nh_grp)) -return ERR_CAST (nh_grp); +if (!nh_grp) +return ERR_PTR (-ENOMEM );refcount_set (&nh_grp->refcount,1 ); }
@@ -651,7 +651,7 @@ prestera_fib_node_create(struct prestera_switch *sw,case PRESTERA_FIB_TYPE_UC_NH : fib_node->info.nh_grp =prestera_nexthop_group_get (sw, nh_grp_key); -if (!fib_node->info.nh_grp) +if (IS_ERR (fib_node->info.nh_grp)) goto err_nh_grp_get; grp_id = fib_node->info.nh_grp->grp_id;
Signature · 1 line
2.35.1
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 12 Oct 2022 18:00:59 +0300 you wrote:
The
__prestera_nexthop_group_create()function returns NULL on error and theprestera_nexthop_group_get()returns error pointers. Fix these two checks.Fixes 0a23ae237171 ("net: marvell: prestera: Add router nexthops ABI")Signed-off-by Dan Carpenter <[email protected]>[...]
Here is the summary with links:
- [net] net: marvell: prestera: fix a couple NULL vs IS_ERR() checks
https://git.kernel.org/netdev/net/c/30e9672ac37f
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html