Skip to contentSkip to conversation

net: ipv4: fixed a brace coding style issue

PATCH In review Armin Gholampoor 2 participants 2 messages Nov 17, 2020 – Nov 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ipv4: fixed a brace coding style issue

Fixed bracing style issue.

---
 net/ipv4/tcp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp.c +1 -2
index b2bc3d7fe..37bc91e4a 100644
@@ -3170,8 +3170,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
 		else if (tp->repair_queue == TCP_RECV_QUEUE) {
 			WRITE_ONCE(tp->rcv_nxt, val);
 			WRITE_ONCE(tp->copied_seq, val);
-		}
-		else
+		} else
 			err = -EINVAL;
 		break;
 
Signature · 1 line
2.29.2
#1 lore raw
Quoted 12 lines · Armin Gholampoor

Fixed bracing style issue.

---
 net/ipv4/tcp.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp.c +0 -0
index b2bc3d7fe..37bc91e4a 100644

net/ipv4/tcp.c static int do_tcp_setsockopt(struct sock *sk, int level, int optname, · line 3175

Quoted 8 lines
net/ipv4/tcp.c +1 -2
@@ -3170,8 +3170,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
  		else if (tp->repair_queue == TCP_RECV_QUEUE) {
  			WRITE_ONCE(tp->rcv_nxt, val);
  			WRITE_ONCE(tp->copied_seq, val);
-		}
-		else
+		} else
  			err = -EINVAL;
  		break;

A more typical brace style would be to use braces on both arms.

And there is more than one of these in the file.

Please fix them all at the same time rather than just a single instance.

Something like:

---
 net/ipv4/tcp.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
net/ipv4/tcp.c +13 -11
index b285b338a019..ae4ec5e29802 100644
@@ -3155,9 +3155,9 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
 		break;
 
 	case TCP_REPAIR:
-		if (!tcp_can_repair_sock(sk))
+		if (!tcp_can_repair_sock(sk)) {
 			err = -EPERM;
-		else if (val == TCP_REPAIR_ON) {
+		} else if (val == TCP_REPAIR_ON) {
 			tp->repair = 1;
 			sk->sk_reuse = SK_FORCE_REUSE;
 			tp->repair_queue = TCP_NO_QUEUE;
@@ -3168,8 +3168,9 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
 		} else if (val == TCP_REPAIR_OFF_NO_WP) {
 			tp->repair = 0;
 			sk->sk_reuse = SK_NO_REUSE;
-		} else
+		} else {
 			err = -EINVAL;
+		}
 
 		break;
 
@@ -3183,16 +3184,16 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
 		break;
 
 	case TCP_QUEUE_SEQ:
-		if (sk->sk_state != TCP_CLOSE)
+		if (sk->sk_state != TCP_CLOSE) {
 			err = -EPERM;
-		else if (tp->repair_queue == TCP_SEND_QUEUE)
+		} else if (tp->repair_queue == TCP_SEND_QUEUE) {
 			WRITE_ONCE(tp->write_seq, val);
-		else if (tp->repair_queue == TCP_RECV_QUEUE) {
+		} else if (tp->repair_queue == TCP_RECV_QUEUE) {
 			WRITE_ONCE(tp->rcv_nxt, val);
 			WRITE_ONCE(tp->copied_seq, val);
-		}
-		else
+		} else {
 			err = -EINVAL;
+		}
 		break;
 
 	case TCP_REPAIR_OPTIONS:
@@ -3261,9 +3262,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
 				break;
 			}
 			tp->window_clamp = 0;
-		} else
+		} else {
 			tp->window_clamp = val < SOCK_MIN_RCVBUF / 2 ?
 						SOCK_MIN_RCVBUF / 2 : val;
+		}
 		break;
 
 	case TCP_QUICKACK:
@@ -3287,8 +3289,8 @@ static int do_tcp_setsockopt(struct sock *sk, int level, int optname,
 		break;
 
 	case TCP_FASTOPEN:
-		if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE |
-		    TCPF_LISTEN))) {
+		if (val >= 0 &&
+		    ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN))) {
 			tcp_fastopen_init_key_once(net);
 
 			fastopen_queue_tune(sk, val);