* [PATCH] net: rxrpc: mark expected switch fall-throughs
@ 2017-10-19 18:50 Gustavo A. R. Silva
2017-10-19 21:16 ` David Howells
0 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-19 18:50 UTC (permalink / raw)
To: David Howells, David S. Miller
Cc: linux-afs, netdev, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
This code was tested by compilation only (GCC 7.2.0 was used).
Please, verify if the actual intention of the code is to fall through.
net/rxrpc/af_rxrpc.c | 5 +++--
net/rxrpc/input.c | 2 +-
net/rxrpc/sendmsg.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index fb17552..df4f7d5 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -246,6 +246,7 @@ static int rxrpc_listen(struct socket *sock, int backlog)
ret = 0;
break;
}
+ /* fall through */
default:
ret = -EBUSY;
break;
@@ -528,8 +529,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
rx->local = local;
rx->sk.sk_state = RXRPC_CLIENT_UNBOUND;
- /* Fall through */
-
+ /* fall through */
case RXRPC_CLIENT_UNBOUND:
case RXRPC_CLIENT_BOUND:
if (!m->msg_name &&
@@ -537,6 +537,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
m->msg_name = &rx->connect_srx;
m->msg_namelen = sizeof(rx->connect_srx);
}
+ /* fall through */
case RXRPC_SERVER_BOUND:
case RXRPC_SERVER_LISTENING:
ret = rxrpc_do_sendmsg(rx, m, len);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index e56e23e..8bc6daf 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -1125,7 +1125,7 @@ void rxrpc_data_ready(struct sock *udp_sk)
case RXRPC_PACKET_TYPE_BUSY:
if (sp->hdr.flags & RXRPC_CLIENT_INITIATED)
goto discard;
-
+ /* fall through */
case RXRPC_PACKET_TYPE_DATA:
if (sp->hdr.callNumber == 0)
goto bad_message;
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 9ea6f97..d245782 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -166,6 +166,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
ktime_get_real());
if (!last)
break;
+ /* fall through */
case RXRPC_CALL_SERVER_SEND_REPLY:
call->state = RXRPC_CALL_SERVER_AWAIT_ACK;
rxrpc_notify_end_tx(rx, call, notify_end_tx);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] net: rxrpc: mark expected switch fall-throughs
2017-10-19 18:50 [PATCH] net: rxrpc: mark expected switch fall-throughs Gustavo A. R. Silva
@ 2017-10-19 21:16 ` David Howells
2017-10-19 21:23 ` Gustavo A. R. Silva
2017-10-19 21:44 ` David Howells
0 siblings, 2 replies; 7+ messages in thread
From: David Howells @ 2017-10-19 21:16 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: dhowells, David S. Miller, linux-afs, netdev, linux-kernel
Gustavo A. R. Silva <garsilva@embeddedor.com> wrote:
> + /* fall through */
All new comments in rxrpc should begin with a capital letter; I'm switching to
this as I modify the lines with comments on. Fix checkpatch or gcc or
whatever takes -Wimplicit-fallthrough to stop being silly.
> - /* Fall through */
> -
> + /* fall through */
No. Firstly, it should be 'F'; secondly, don't remove the blank line - it's
there for a reason.
> + /* fall through */
Capital 'F'.
> -
> + /* fall through */
Don't remove the blank line. Capital 'F'.
> + /* fall through */
Capital 'F'.
David
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: rxrpc: mark expected switch fall-throughs
2017-10-19 21:16 ` David Howells
@ 2017-10-19 21:23 ` Gustavo A. R. Silva
2017-10-19 21:44 ` David Howells
1 sibling, 0 replies; 7+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-19 21:23 UTC (permalink / raw)
To: David Howells; +Cc: David S. Miller, linux-afs, netdev, linux-kernel
Quoting David Howells <dhowells@redhat.com>:
> Gustavo A. R. Silva <garsilva@embeddedor.com> wrote:
>
>> + /* fall through */
>
> All new comments in rxrpc should begin with a capital letter; I'm
> switching to
> this as I modify the lines with comments on. Fix checkpatch or gcc or
> whatever takes -Wimplicit-fallthrough to stop being silly.
>
>> - /* Fall through */
>> -
>> + /* fall through */
>
> No. Firstly, it should be 'F'; secondly, don't remove the blank line - it's
> there for a reason.
>
What is the reason?
>> + /* fall through */
>
> Capital 'F'.
>
>> -
>> + /* fall through */
>
> Don't remove the blank line. Capital 'F'.
>
>> + /* fall through */
>
> Capital 'F'.
>
> David
Thanks
--
Gustavo A. R. Silva
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: rxrpc: mark expected switch fall-throughs
2017-10-19 21:16 ` David Howells
2017-10-19 21:23 ` Gustavo A. R. Silva
@ 2017-10-19 21:44 ` David Howells
2017-10-19 21:50 ` Gustavo A. R. Silva
1 sibling, 1 reply; 7+ messages in thread
From: David Howells @ 2017-10-19 21:44 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: dhowells, David S. Miller, linux-afs, netdev, linux-kernel
Gustavo A. R. Silva <garsilva@embeddedor.com> wrote:
> > No. Firstly, it should be 'F'; secondly, don't remove the blank line - it's
> > there for a reason.
> >
>
> What is the reason?
Visual separation.
David
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] net: rxrpc: mark expected switch fall-throughs
2017-10-19 21:44 ` David Howells
@ 2017-10-19 21:50 ` Gustavo A. R. Silva
2017-10-19 21:54 ` [PATCH v2] " Gustavo A. R. Silva
0 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-19 21:50 UTC (permalink / raw)
To: David Howells; +Cc: David S. Miller, linux-afs, netdev, linux-kernel
Quoting David Howells <dhowells@redhat.com>:
>> What is the reason?
>
> Visual separation.
>
Thanks for clarifying.
--
Gustavo A. R. Silva
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] net: rxrpc: mark expected switch fall-throughs
2017-10-19 21:50 ` Gustavo A. R. Silva
@ 2017-10-19 21:54 ` Gustavo A. R. Silva
2017-10-24 9:27 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-19 21:54 UTC (permalink / raw)
To: David Howells, David S. Miller
Cc: linux-afs, netdev, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
This code was tested by compilation only (GCC 7.2.0 was used).
Please, verify if the actual intention of the code is to fall through.
Changes in v2:
Start every "Fall through" comment with capital 'F'.
Put back blank lines.
net/rxrpc/af_rxrpc.c | 2 ++
net/rxrpc/input.c | 1 +
net/rxrpc/sendmsg.c | 1 +
3 files changed, 4 insertions(+)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index fb17552..73d5665 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -246,6 +246,7 @@ static int rxrpc_listen(struct socket *sock, int backlog)
ret = 0;
break;
}
+ /* Fall through */
default:
ret = -EBUSY;
break;
@@ -537,6 +538,7 @@ static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len)
m->msg_name = &rx->connect_srx;
m->msg_namelen = sizeof(rx->connect_srx);
}
+ /* Fall through */
case RXRPC_SERVER_BOUND:
case RXRPC_SERVER_LISTENING:
ret = rxrpc_do_sendmsg(rx, m, len);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index e56e23e..1e37eb1 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -1125,6 +1125,7 @@ void rxrpc_data_ready(struct sock *udp_sk)
case RXRPC_PACKET_TYPE_BUSY:
if (sp->hdr.flags & RXRPC_CLIENT_INITIATED)
goto discard;
+ /* Fall through */
case RXRPC_PACKET_TYPE_DATA:
if (sp->hdr.callNumber == 0)
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 9ea6f97..dbe0c4d 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -166,6 +166,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
ktime_get_real());
if (!last)
break;
+ /* Fall through */
case RXRPC_CALL_SERVER_SEND_REPLY:
call->state = RXRPC_CALL_SERVER_AWAIT_ACK;
rxrpc_notify_end_tx(rx, call, notify_end_tx);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] net: rxrpc: mark expected switch fall-throughs
2017-10-19 21:54 ` [PATCH v2] " Gustavo A. R. Silva
@ 2017-10-24 9:27 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-10-24 9:27 UTC (permalink / raw)
To: garsilva; +Cc: dhowells, linux-afs, netdev, linux-kernel
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Thu, 19 Oct 2017 16:54:48 -0500
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> This code was tested by compilation only (GCC 7.2.0 was used).
> Please, verify if the actual intention of the code is to fall through.
>
> Changes in v2:
> Start every "Fall through" comment with capital 'F'.
> Put back blank lines.
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-10-24 9:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-19 18:50 [PATCH] net: rxrpc: mark expected switch fall-throughs Gustavo A. R. Silva
2017-10-19 21:16 ` David Howells
2017-10-19 21:23 ` Gustavo A. R. Silva
2017-10-19 21:44 ` David Howells
2017-10-19 21:50 ` Gustavo A. R. Silva
2017-10-19 21:54 ` [PATCH v2] " Gustavo A. R. Silva
2017-10-24 9:27 ` David Miller
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).