* [PATCH] net: l2tp: mark expected switch fall-through
@ 2017-10-17 22:42 Gustavo A. R. Silva
2017-10-19 8:51 ` Guillaume Nault
2017-10-19 12:34 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-17 22:42 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel, Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Notice that in this particular case I replaced the "NOBREAK" comment with
a "fall through" comment, which is what GCC is expecting to find.
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
This code was tested by compilation only (GCC 7.2.0 was used).
net/l2tp/l2tp_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 7135f46..f517942 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -406,7 +406,7 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
if (nla_put_u16(skb, L2TP_ATTR_UDP_SPORT, ntohs(inet->inet_sport)) ||
nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)))
goto nla_put_failure;
- /* NOBREAK */
+ /* fall through */
case L2TP_ENCAPTYPE_IP:
#if IS_ENABLED(CONFIG_IPV6)
if (np) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: l2tp: mark expected switch fall-through
2017-10-17 22:42 [PATCH] net: l2tp: mark expected switch fall-through Gustavo A. R. Silva
@ 2017-10-19 8:51 ` Guillaume Nault
2017-10-19 12:34 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Guillaume Nault @ 2017-10-19 8:51 UTC (permalink / raw)
To: Gustavo A. R. Silva; +Cc: David S. Miller, netdev, linux-kernel
On Tue, Oct 17, 2017 at 05:42:53PM -0500, Gustavo A. R. Silva wrote:
> This code was tested by compilation only (GCC 7.2.0 was used).
>
No worry, this case really has to fall through.
> diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
> index 7135f46..f517942 100644
> --- a/net/l2tp/l2tp_netlink.c
> +++ b/net/l2tp/l2tp_netlink.c
> @@ -406,7 +406,7 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
> if (nla_put_u16(skb, L2TP_ATTR_UDP_SPORT, ntohs(inet->inet_sport)) ||
> nla_put_u16(skb, L2TP_ATTR_UDP_DPORT, ntohs(inet->inet_dport)))
> goto nla_put_failure;
> - /* NOBREAK */
> + /* fall through */
> case L2TP_ENCAPTYPE_IP:
>
Nit: extra whitespace before '*/' (just couldn't restrain myself from
noticing).
Acked-by: Guillaume Nault <g.nault@alphalink.fr>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: l2tp: mark expected switch fall-through
2017-10-17 22:42 [PATCH] net: l2tp: mark expected switch fall-through Gustavo A. R. Silva
2017-10-19 8:51 ` Guillaume Nault
@ 2017-10-19 12:34 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-10-19 12:34 UTC (permalink / raw)
To: garsilva; +Cc: netdev, linux-kernel
From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Date: Tue, 17 Oct 2017 17:42:53 -0500
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
>
> Notice that in this particular case I replaced the "NOBREAK" comment with
> a "fall through" comment, which is what GCC is expecting to find.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Applied to net-next.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-19 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 22:42 [PATCH] net: l2tp: mark expected switch fall-through Gustavo A. R. Silva
2017-10-19 8:51 ` Guillaume Nault
2017-10-19 12:34 ` 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).