netdevsim: remove redundant branch
Subsystems (3)
PATCH 1/1 netdevsim: remove redundant branch
bool notify is referenced nowhere else in the function except to check whether or not to call rtnl_offload_xstats_notify(). Remove it and move the call to the previous branch.
--- drivers/net/netdevsim/hwstats.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/netdevsim/hwstats.c +1 -4
@@ -220,7 +220,6 @@ nsim_dev_hwstats_enable_ifindex(struct nsim_dev_hwstats *hwstats,struct nsim_dev_hwstats_netdev *hwsdev;struct nsim_dev *nsim_dev;struct net_device *netdev; -bool notify = false;struct net *net;int err =0 ;
@@ -251,11 +250,9 @@ nsim_dev_hwstats_enable_ifindex(struct nsim_dev_hwstats *hwstats,if (netdev_offload_xstats_enabled (netdev, type)) {nsim_dev_hwsdev_enable (hwsdev,NULL ); - notify = true; +rtnl_offload_xstats_notify (netdev); } -if (notify) -rtnl_offload_xstats_notify (netdev);rtnl_unlock ();return err;
Signature · 1 line
2.50.1
+ Petr
Quoted 8 lines · Dennis Chen
bool notify is referenced nowhere else in the function except to check whether or not to call
rtnl_offload_xstats_notify(). Remove it and move the call to the previous branch.Signed-off-by Dennis Chen <[email protected]>--- drivers/net/netdevsim/hwstats.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Thanks Dennis,
This looks like a nice clean-up to me.
I guess this is an artefact of the development of this code as this pattern has been present since the code was added by Petr Machata (CCed) in commit 1a6d7ae7d63c ("netdevsim: Introduce support for L3 offload xstats").
Petr Machata
Reviewed-byQuoted 12 lines · Simon Horman
Quoted 8 lines · Dennis Chen
bool notify is referenced nowhere else in the function except to check whether or not to call
rtnl_offload_xstats_notify(). Remove it and move the call to the previous branch.Signed-off-by Dennis Chen <[email protected]>--- drivers/net/netdevsim/hwstats.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)Thanks Dennis,
Quoted 7 lines
This looks like a nice clean-up to me.
I guess this is an artefact of the development of this code as this pattern has been present since the code was added by Petr Machata (CCed) in commit
1a6d7ae7d63c("netdevsim: Introduce support for L3 offload xstats").Reviewed-by Simon Horman <[email protected]>
Thanks for the CC!
There was some locking / cleanup business originally that necessitated the variable. That went away during internal review, but this was left behind. I agree it can be cleaned up.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Wed, 16 Jul 2025 12:57:50 -0400 you wrote:
bool notify is referenced nowhere else in the function except to check whether or not to call
rtnl_offload_xstats_notify(). Remove it and move the call to the previous branch.Signed-off-by Dennis Chen <[email protected]>--- drivers/net/netdevsim/hwstats.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Here is the summary with links:
- netdevsim: remove redundant branch
https://git.kernel.org/netdev/net-next/c/a93f38ebff57
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html