netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: remove redundant check
@ 2024-08-20 11:54 Xi Huang
  2024-08-20 11:59 ` Florian Westphal
  2024-08-22  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Xi Huang @ 2024-08-20 11:54 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, netdev, linux-kernel,
	xuiagnh

err varibale will be set everytime,like -ENOBUFS and in if (err < 0),
 when code gets into this path. This check will just slowdown
the execution and that's all.

Signed-off-by: Xi Huang <xuiagnh@gmail.com>
---
 net/ipv6/addrconf.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f70d8757a..7372ae469 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5617,8 +5617,7 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
 	rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC);
 	return;
 errout:
-	if (err < 0)
-		rtnl_set_sk_err(net, RTNLGRP_IPV6_IFADDR, err);
+	rtnl_set_sk_err(net, RTNLGRP_IPV6_IFADDR, err);
 }
 
 static void ipv6_store_devconf(const struct ipv6_devconf *cnf,
@@ -6173,8 +6172,7 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
 	rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFINFO, NULL, GFP_ATOMIC);
 	return;
 errout:
-	if (err < 0)
-		rtnl_set_sk_err(net, RTNLGRP_IPV6_IFINFO, err);
+	rtnl_set_sk_err(net, RTNLGRP_IPV6_IFINFO, err);
 }
 
 static inline size_t inet6_prefix_nlmsg_size(void)
@@ -6241,8 +6239,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
 	rtnl_notify(skb, net, 0, RTNLGRP_IPV6_PREFIX, NULL, GFP_ATOMIC);
 	return;
 errout:
-	if (err < 0)
-		rtnl_set_sk_err(net, RTNLGRP_IPV6_PREFIX, err);
+	rtnl_set_sk_err(net, RTNLGRP_IPV6_PREFIX, err);
 }
 
 static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv6: remove redundant check
  2024-08-20 11:54 [PATCH] ipv6: remove redundant check Xi Huang
@ 2024-08-20 11:59 ` Florian Westphal
  2024-08-22  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2024-08-20 11:59 UTC (permalink / raw)
  To: Xi Huang; +Cc: davem, dsahern, edumazet, kuba, pabeni, netdev, linux-kernel

Xi Huang <xuiagnh@gmail.com> wrote:
> err varibale will be set everytime,like -ENOBUFS and in if (err < 0),
>  when code gets into this path. This check will just slowdown
> the execution and that's all.

Compiler agrees, those conditionals get removed at compile time.

Reviewed-by: Florian Westphal <fw@strlen.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv6: remove redundant check
  2024-08-20 11:54 [PATCH] ipv6: remove redundant check Xi Huang
  2024-08-20 11:59 ` Florian Westphal
@ 2024-08-22  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-22  0:40 UTC (permalink / raw)
  To: Xi Huang; +Cc: davem, dsahern, edumazet, kuba, pabeni, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 20 Aug 2024 19:54:42 +0800 you wrote:
> err varibale will be set everytime,like -ENOBUFS and in if (err < 0),
>  when code gets into this path. This check will just slowdown
> the execution and that's all.
> 
> Signed-off-by: Xi Huang <xuiagnh@gmail.com>
> ---
>  net/ipv6/addrconf.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Here is the summary with links:
  - ipv6: remove redundant check
    https://git.kernel.org/netdev/net-next/c/d35a3a8f1b7f

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] 3+ messages in thread

end of thread, other threads:[~2024-08-22  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 11:54 [PATCH] ipv6: remove redundant check Xi Huang
2024-08-20 11:59 ` Florian Westphal
2024-08-22  0:40 ` 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).