net: rxrpc: mark expected switch fall-throughs
Subsystems (3)
PATCH 1/1 net: rxrpc: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
---
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(-)
net/rxrpc/af_rxrpc.c +3 -2
@@ -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);
net/rxrpc/input.c +1 -1
@@ -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;
net/rxrpc/sendmsg.c +1 -0
@@ -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);
Signature · 1 line
2.7.4
David Howells
maintainerReview
Quoted 1 line · Gustavo A. R. Silva
(quoted diff) +1
-0+ /* 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.
net/rxrpc/af_rxrpc.c static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len) · line 532
Quoted 3 lines
net/rxrpc/af_rxrpc.c +1
-2-/* Fall through */ - +/* fall through */
No. Firstly, it should be 'F'; secondly, don't remove the blank line - it's there for a reason.
Review
Quoted 1 line
(quoted diff) +1
-0+ /* fall through */
Capital 'F'.
Review
Quoted 2 lines
(quoted diff) +1
-1- + /* fall through */
Don't remove the blank line. Capital 'F'.
Review
Quoted 1 line
(quoted diff) +1
-0+ /* fall through */
Capital 'F'.
David
Quoting David Howells <[email protected]>:
Quoted 8 lines
Review
Quoted 1 line · Gustavo A. R. Silva
(quoted diff) +1
-0+ /* 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.
Quoted 7 lines
net/rxrpc/af_rxrpc.c static int rxrpc_sendmsg(struct socket *sock, struct msghdr *m, size_t len) · line 532
Quoted 3 lines
net/rxrpc/af_rxrpc.c +1
-2-/* 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?
Quoted 9 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ /* fall through */Capital 'F'.
Review
Quoted 2 lines
(quoted diff) +1
-1- + /* fall through */Don't remove the blank line. Capital 'F'.
Quoted 5 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ /* fall through */Capital 'F'.
David
Thanks
--
Gustavo A. R. Silva
David Howells
maintainerQuoted 5 lines · Gustavo A. R. Silva
Quoted 3 lines
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
Quoting David Howells <[email protected]>:
Quoted 4 lines
Quoted 1 line
What is the reason?
Visual separation.
Thanks for clarifying.
--
Gustavo A. R. Silva
PATCH v2 1/1 net: rxrpc: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
---
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(+)
net/rxrpc/af_rxrpc.c +2 -0
@@ -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);
net/rxrpc/input.c +1 -0
@@ -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 )
net/rxrpc/sendmsg.c +1 -0
@@ -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);
Signature · 1 line
2.7.4
From: "Gustavo A. R. Silva" <[email protected]>
Date: Thu, 19 Oct 2017 16:54:48 -0500
Quoted 11 lines
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.
Signed-off-by Gustavo A. R. Silva <[email protected]>---
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.