diff mbox series

net: Add 'else' to split mutually exclusive case

Message ID 20200827111552.38789-1-linmiaohe@huawei.com
State Rejected
Delegated to: David Miller
Headers show
Series net: Add 'else' to split mutually exclusive case | expand

Commit Message

Miaohe Lin Aug. 27, 2020, 11:15 a.m. UTC
Add else to split mutually exclusive case and avoid unnecessary check.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/ipv4/ping.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Aug. 27, 2020, 4:10 p.m. UTC | #1
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Thu, 27 Aug 2020 07:15:52 -0400

> Add else to split mutually exclusive case and avoid unnecessary check.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

I see no value to this, the compiler is doing the right thing already
and this does not add to code readability either.

I'm not applying this, sorry.
diff mbox series

Patch

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 19a947bf0faa..265676fd2bbd 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -422,7 +422,7 @@  int ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	if (sk->sk_family == AF_INET && isk->inet_rcv_saddr)
 		sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
 #if IS_ENABLED(CONFIG_IPV6)
-	if (sk->sk_family == AF_INET6 && !ipv6_addr_any(&sk->sk_v6_rcv_saddr))
+	else if (sk->sk_family == AF_INET6 && !ipv6_addr_any(&sk->sk_v6_rcv_saddr))
 		sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
 #endif