mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Armin Gholampoor <armingh379@gmail.com>, davem@davemloft.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: ipv4: fixed a brace coding style issue
Date: Tue, 17 Nov 2020 18:02:11 -0800	[thread overview]
Message-ID: <6447e7bc3515da26ab7f1b02ed178a6859af789a.camel@perches.com> (raw)
In-Reply-To: <20201118063744.214744-1-armingh379@gmail.com>

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



      reply	other threads:[~2020-11-18  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  6:37 Armin Gholampoor
2020-11-18  2:02 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6447e7bc3515da26ab7f1b02ed178a6859af789a.camel@perches.com \
    --to=joe@perches.com \
    --cc=armingh379@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®