vxlan_core: delete unnecessary condition
Subsystems (3)
PATCH 1/1 vxlan_core: delete unnecessary condition
The previous check handled the "if (!nh)" condition so we know "nh" is non-NULL here. Delete the check and pull the code in one tab.
---
This not a bug so a Fixes tag is innappropriate, however for reviewers this was introduced in commit 4095e0e1328a ("drivers: vxlan: vnifilter:
per vni stats")
--- drivers/net/vxlan/vxlan_core.c | 54 ++++++++++++++++------------------ 1 file changed, 26 insertions(+), 28 deletions(-)
drivers/net/vxlan/vxlan_core.c +26 -28
@@ -811,37 +811,35 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb, goto err_inval; } -if (nh) { -if (!nexthop_get (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop has been deleted" ); - nh =NULL ; - goto err_inval; - } -if (!nexthop_is_fdb (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); - goto err_inval; - } +if (!nexthop_get (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop has been deleted" ); + nh =NULL ; + goto err_inval; + } +if (!nexthop_is_fdb (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); + goto err_inval; + } -if (!nexthop_is_multipath (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop is not a multipath group" ); +if (!nexthop_is_multipath (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop is not a multipath group" ); + goto err_inval; + } + +/* check nexthop group family */ +switch (vxlan->default_dst.remote_ip.sa.sa_family) { +case AF_INET : +if (!nexthop_has_v4 (nh)) { + err = -EAFNOSUPPORT ; +NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); goto err_inval; } - -/* check nexthop group family */ -switch (vxlan->default_dst.remote_ip.sa.sa_family) { -case AF_INET : -if (!nexthop_has_v4 (nh)) { - err = -EAFNOSUPPORT ; -NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); - goto err_inval; - } -break ; -case AF_INET6 : -if (nexthop_has_v4 (nh)) { - err = -EAFNOSUPPORT ; -NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); - goto err_inval; - } +break ; +case AF_INET6 : +if (nexthop_has_v4 (nh)) { + err = -EAFNOSUPPORT ; +NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); + goto err_inval; } }
Signature · 1 line
2.20.1
Quoted 8 lines · Dan Carpenter
The previous check handled the "if (!nh)" condition so we know "nh" is non-NULL here. Delete the check and pull the code in one tab.
Signed-off-by Dan Carpenter <[email protected]>---
This not a bug so a Fixes tag is innappropriate, however for reviewers this was introduced in commit4095e0e1328a("drivers: vxlan: vnifilter:
per vni stats")
No, it was not introduced by that commit.
It was introduced by commit:
1274e1cc4226 ("vxlan: ecmp support for mac fdb entries")
Quoted 72 lines
--- drivers/net/vxlan/vxlan_core.c | 54 ++++++++++++++++------------------ 1 file changed, 26 insertions(+), 28 deletions(-)drivers/net/vxlan/vxlan_core.c +26
-28@@ -811,37 +811,35 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb, goto err_inval; } -if (nh) { -if (!nexthop_get (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop has been deleted" ); - nh =NULL ; - goto err_inval; - } -if (!nexthop_is_fdb (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); - goto err_inval; - } +if (!nexthop_get (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop has been deleted" ); + nh =NULL ; + goto err_inval; + } +if (!nexthop_is_fdb (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); + goto err_inval; + } -if (!nexthop_is_multipath (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop is not a multipath group" ); +if (!nexthop_is_multipath (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop is not a multipath group" ); + goto err_inval; + } + +/* check nexthop group family */ +switch (vxlan->default_dst.remote_ip.sa.sa_family) { +case AF_INET : +if (!nexthop_has_v4 (nh)) { + err = -EAFNOSUPPORT ; +NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); goto err_inval; } - -/* check nexthop group family */ -switch (vxlan->default_dst.remote_ip.sa.sa_family) { -case AF_INET : -if (!nexthop_has_v4 (nh)) { - err = -EAFNOSUPPORT ; -NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); - goto err_inval; - } -break ; -case AF_INET6 : -if (nexthop_has_v4 (nh)) { - err = -EAFNOSUPPORT ; -NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); - goto err_inval; - } +break ; +case AF_INET6 : +if (nexthop_has_v4 (nh)) { + err = -EAFNOSUPPORT ; +NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); + goto err_inval; } }
Nikolay Aleksandrov
Reviewed-byQuoted 10 lines · Nikolay Aleksandrov
Quoted 8 lines · Dan Carpenter
The previous check handled the "if (!nh)" condition so we know "nh" is non-NULL here. Delete the check and pull the code in one tab.
Signed-off-by Dan Carpenter <[email protected]>---
This not a bug so a Fixes tag is innappropriate, however for reviewers this was introduced in commit4095e0e1328a("drivers: vxlan: vnifilter:
per vni stats")
Quoted 4 lines
No, it was not introduced by that commit.
It was introduced by commit:
1274e1cc4226("vxlan: ecmp support for mac fdb entries")
Forgot to add: patch looks good to me. :)
Thanks,
Nik
Quoted 73 lines
Quoted 72 lines
--- drivers/net/vxlan/vxlan_core.c | 54 ++++++++++++++++------------------ 1 file changed, 26 insertions(+), 28 deletions(-)drivers/net/vxlan/vxlan_core.c +26
-28@@ -811,37 +811,35 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb, goto err_inval; } -if (nh) { -if (!nexthop_get (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop has been deleted" ); - nh =NULL ; - goto err_inval; - } -if (!nexthop_is_fdb (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); - goto err_inval; - } +if (!nexthop_get (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop has been deleted" ); + nh =NULL ; + goto err_inval; + } +if (!nexthop_is_fdb (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop is not a fdb nexthop" ); + goto err_inval; + } -if (!nexthop_is_multipath (nh)) { -NL_SET_ERR_MSG (extack,"Nexthop is not a multipath group" ); +if (!nexthop_is_multipath (nh)) { +NL_SET_ERR_MSG (extack,"Nexthop is not a multipath group" ); + goto err_inval; + } + +/* check nexthop group family */ +switch (vxlan->default_dst.remote_ip.sa.sa_family) { +case AF_INET : +if (!nexthop_has_v4 (nh)) { + err = -EAFNOSUPPORT ; +NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); goto err_inval; } - -/* check nexthop group family */ -switch (vxlan->default_dst.remote_ip.sa.sa_family) { -case AF_INET : -if (!nexthop_has_v4 (nh)) { - err = -EAFNOSUPPORT ; -NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); - goto err_inval; - } -break ; -case AF_INET6 : -if (nexthop_has_v4 (nh)) { - err = -EAFNOSUPPORT ; -NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); - goto err_inval; - } +break ; +case AF_INET6 : +if (nexthop_has_v4 (nh)) { + err = -EAFNOSUPPORT ; +NL_SET_ERR_MSG (extack,"Nexthop group family not supported" ); + goto err_inval; } }
Roopa Prabhu
Reviewed-byQuoted 10 lines · Nikolay Aleksandrov
Quoted 9 lines · Nikolay Aleksandrov
Quoted 8 lines · Dan Carpenter
The previous check handled the "if (!nh)" condition so we know "nh" is non-NULL here. Delete the check and pull the code in one tab.
Signed-off-by Dan Carpenter <[email protected]>---
This not a bug so a Fixes tag is innappropriate, however for reviewers this was introduced in commit4095e0e1328a("drivers: vxlan: vnifilter:
per vni stats")
Quoted 6 lines
Quoted 4 lines
No, it was not introduced by that commit.
It was introduced by commit:
1274e1cc4226("vxlan: ecmp support for mac fdb entries")Forgot to add: patch looks good to me. :)
Reviewed-by Nikolay Aleksandrov <[email protected]>
+1
LGTM too, thanks Dan
Quoted 10 lines · Nikolay Aleksandrov
Quoted 8 lines · Dan Carpenter
The previous check handled the "if (!nh)" condition so we know "nh" is non-NULL here. Delete the check and pull the code in one tab.
Signed-off-by Dan Carpenter <[email protected]>---
This not a bug so a Fixes tag is innappropriate, however for reviewers this was introduced in commit4095e0e1328a("drivers: vxlan: vnifilter:
per vni stats")
Quoted 3 lines
No, it was not introduced by that commit.
It was introduced by commit:
1274e1cc4226("vxlan: ecmp support for mac fdb entries")
Yeah. Sorry. No idea how I got that wrong.
regards,
dan carpenter
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 7 Mar 2022 15:57:36 +0300 you wrote:
The previous check handled the "if (!nh)" condition so we know "nh" is non-NULL here. Delete the check and pull the code in one tab.
Signed-off-by Dan Carpenter <[email protected]>---
This not a bug so a Fixes tag is innappropriate, however for reviewers this was introduced in commit4095e0e1328a("drivers: vxlan: vnifilter:
per vni stats")[...]
Here is the summary with links:
- [net-next] vxlan_core: delete unnecessary condition
https://git.kernel.org/netdev/net-next/c/8daf4e75fc09
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html