* [PATCH] netdevsim: remove redundant branch
@ 2025-07-16 16:57 Dennis Chen
2025-07-17 11:56 ` Simon Horman
2025-07-18 1:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Dennis Chen @ 2025-07-16 16:57 UTC (permalink / raw)
To: netdev
Cc: dechen, Jakub Kicinski, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-kernel
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 <dechen@redhat.com>
---
drivers/net/netdevsim/hwstats.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/netdevsim/hwstats.c b/drivers/net/netdevsim/hwstats.c
index 66b3215db3acd..1abe48e35ca3a 100644
--- a/drivers/net/netdevsim/hwstats.c
+++ b/drivers/net/netdevsim/hwstats.c
@@ -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;
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netdevsim: remove redundant branch
2025-07-16 16:57 [PATCH] netdevsim: remove redundant branch Dennis Chen
@ 2025-07-17 11:56 ` Simon Horman
2025-07-17 13:21 ` Petr Machata
2025-07-18 1:20 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Simon Horman @ 2025-07-17 11:56 UTC (permalink / raw)
To: Dennis Chen
Cc: netdev, Jakub Kicinski, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-kernel, Petr Machata
+ Petr
On Wed, Jul 16, 2025 at 12:57:50PM -0400, Dennis Chen 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 <dechen@redhat.com>
> ---
> 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").
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netdevsim: remove redundant branch
2025-07-17 11:56 ` Simon Horman
@ 2025-07-17 13:21 ` Petr Machata
0 siblings, 0 replies; 4+ messages in thread
From: Petr Machata @ 2025-07-17 13:21 UTC (permalink / raw)
To: Simon Horman
Cc: Dennis Chen, netdev, Jakub Kicinski, Andrew Lunn, David S. Miller,
Eric Dumazet, Paolo Abeni, linux-kernel, Petr Machata
Simon Horman <horms@kernel.org> writes:
> On Wed, Jul 16, 2025 at 12:57:50PM -0400, Dennis Chen 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 <dechen@redhat.com>
>> ---
>> 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").
>
> Reviewed-by: Simon Horman <horms@kernel.org>
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.
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netdevsim: remove redundant branch
2025-07-16 16:57 [PATCH] netdevsim: remove redundant branch Dennis Chen
2025-07-17 11:56 ` Simon Horman
@ 2025-07-18 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-18 1:20 UTC (permalink / raw)
To: Dennis Chen
Cc: netdev, kuba, andrew+netdev, davem, edumazet, pabeni,
linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
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 <dechen@redhat.com>
> ---
> 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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-18 1:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-16 16:57 [PATCH] netdevsim: remove redundant branch Dennis Chen
2025-07-17 11:56 ` Simon Horman
2025-07-17 13:21 ` Petr Machata
2025-07-18 1:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).