linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] net: ipv4: fixed a brace coding style issue
  2020-11-18  6:37 [PATCH] net: ipv4: fixed a brace coding style issue Armin Gholampoor
@ 2020-11-18  2:02 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2020-11-18  2:02 UTC (permalink / raw)
  To: Armin Gholampoor, davem; +Cc: linux-kernel

On Wed, 2020-11-18 at 01:37 -0500, Armin Gholampoor wrote:
> Fixed bracing style issue.
> 
> Signed-off-by: Armin Gholampoor <armingh379@gmail.com>
> ---
>  net/ipv4/tcp.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index b2bc3d7fe..37bc91e4a 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -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(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b285b338a019..ae4ec5e29802 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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);



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

* [PATCH] net: ipv4: fixed a brace coding style issue
@ 2020-11-18  6:37 Armin Gholampoor
  2020-11-18  2:02 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Armin Gholampoor @ 2020-11-18  6:37 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, Armin Gholampoor

Fixed bracing style issue.

Signed-off-by: Armin Gholampoor <armingh379@gmail.com>
---
 net/ipv4/tcp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index b2bc3d7fe..37bc91e4a 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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;
 
-- 
2.29.2


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

end of thread, other threads:[~2020-11-18  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18  6:37 [PATCH] net: ipv4: fixed a brace coding style issue Armin Gholampoor
2020-11-18  2:02 ` Joe Perches

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).