Skip to content

Commit a8eceea

Browse files
JoePerchesdavem330
authored andcommitted
inet: Use fallthrough;
Convert the various uses of fallthrough comments to fallthrough; Done via script Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe@perches.com/ And by hand: net/ipv6/ip6_fib.c has a fallthrough comment outside of an #ifdef block that causes gcc to emit a warning if converted in-place. So move the new fallthrough; inside the containing #ifdef/#endif too. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a76547 commit a8eceea

26 files changed

+41
-43
lines changed

net/ipv4/af_inet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ int inet_shutdown(struct socket *sock, int how)
872872
err = -ENOTCONN;
873873
/* Hack to wake up other listeners, who can poll for
874874
EPOLLHUP, even on eg. unconnected UDP sockets -- RR */
875-
/* fall through */
875+
fallthrough;
876876
default:
877877
sk->sk_shutdown |= how;
878878
if (sk->sk_prot->shutdown)
@@ -886,7 +886,7 @@ int inet_shutdown(struct socket *sock, int how)
886886
case TCP_LISTEN:
887887
if (!(how & RCV_SHUTDOWN))
888888
break;
889-
/* fall through */
889+
fallthrough;
890890
case TCP_SYN_SENT:
891891
err = sk->sk_prot->disconnect(sk, O_NONBLOCK);
892892
sock->state = err ? SS_DISCONNECTING : SS_UNCONNECTED;

net/ipv4/ah4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int ip_clear_mutable_options(const struct iphdr *iph, __be32 *daddr)
107107
if (optlen < 6)
108108
return -EINVAL;
109109
memcpy(daddr, optptr+optlen-4, 4);
110-
/* Fall through */
110+
fallthrough;
111111
default:
112112
memset(optptr, 0, optlen);
113113
}

net/ipv4/arp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
11811181
case SIOCSARP:
11821182
if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
11831183
return -EPERM;
1184-
/* fall through */
1184+
fallthrough;
11851185
case SIOCGARP:
11861186
err = copy_from_user(&r, arg, sizeof(struct arpreq));
11871187
if (err)

net/ipv4/devinet.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,11 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
15661566
}
15671567
}
15681568
ip_mc_up(in_dev);
1569-
/* fall through */
1569+
fallthrough;
15701570
case NETDEV_CHANGEADDR:
15711571
if (!IN_DEV_ARP_NOTIFY(in_dev))
15721572
break;
1573-
/* fall through */
1573+
fallthrough;
15741574
case NETDEV_NOTIFY_PEERS:
15751575
/* Send gratuitous ARP to notify of link change */
15761576
inetdev_send_gratuitous_arp(dev, in_dev);
@@ -1588,7 +1588,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
15881588
if (inetdev_valid_mtu(dev->mtu))
15891589
break;
15901590
/* disable IP when MTU is not enough */
1591-
/* fall through */
1591+
fallthrough;
15921592
case NETDEV_UNREGISTER:
15931593
inetdev_destroy(in_dev);
15941594
break;

net/ipv4/fib_semantics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force)
19621962
case NETDEV_DOWN:
19631963
case NETDEV_UNREGISTER:
19641964
nexthop_nh->fib_nh_flags |= RTNH_F_DEAD;
1965-
/* fall through */
1965+
fallthrough;
19661966
case NETDEV_CHANGE:
19671967
nexthop_nh->fib_nh_flags |= RTNH_F_LINKDOWN;
19681968
break;
@@ -1984,7 +1984,7 @@ int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force)
19841984
case NETDEV_DOWN:
19851985
case NETDEV_UNREGISTER:
19861986
fi->fib_flags |= RTNH_F_DEAD;
1987-
/* fall through */
1987+
fallthrough;
19881988
case NETDEV_CHANGE:
19891989
fi->fib_flags |= RTNH_F_LINKDOWN;
19901990
break;

net/ipv4/icmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ static bool icmp_unreach(struct sk_buff *skb)
865865
case 3:
866866
if (!icmp_tag_validation(iph->protocol))
867867
goto out;
868-
/* fall through */
868+
fallthrough;
869869
case 0:
870870
info = ntohs(icmph->un.frag.mtu);
871871
}

net/ipv4/ip_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static int ip_mc_finish_output(struct net *net, struct sock *sk,
333333
switch (ret) {
334334
case NET_XMIT_CN:
335335
do_cn = true;
336-
/* fall through */
336+
fallthrough;
337337
case NET_XMIT_SUCCESS:
338338
break;
339339
default:

net/ipv4/ipmr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval,
14651465
case MRT_ADD_MFC:
14661466
case MRT_DEL_MFC:
14671467
parent = -1;
1468-
/* fall through */
1468+
fallthrough;
14691469
case MRT_ADD_MFC_PROXY:
14701470
case MRT_DEL_MFC_PROXY:
14711471
if (optlen != sizeof(mfc)) {

net/ipv4/netfilter/nf_log_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static void dump_ipv4_packet(struct net *net, struct nf_log_buf *m,
173173
case ICMP_REDIRECT:
174174
/* Max length: 24 "GATEWAY=255.255.255.255 " */
175175
nf_log_buf_add(m, "GATEWAY=%pI4 ", &ich->un.gateway);
176-
/* Fall through */
176+
fallthrough;
177177
case ICMP_DEST_UNREACH:
178178
case ICMP_SOURCE_QUENCH:
179179
case ICMP_TIME_EXCEEDED:

net/ipv4/netfilter/nf_nat_pptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ pptp_outbound_pkt(struct sk_buff *skb,
168168
pr_debug("unknown outbound packet 0x%04x:%s\n", msg,
169169
msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
170170
pptp_msg_name[0]);
171-
/* fall through */
171+
fallthrough;
172172
case PPTP_SET_LINK_INFO:
173173
/* only need to NAT in case PAC is behind NAT box */
174174
case PPTP_START_SESSION_REQUEST:
@@ -271,7 +271,7 @@ pptp_inbound_pkt(struct sk_buff *skb,
271271
pr_debug("unknown inbound packet %s\n",
272272
msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
273273
pptp_msg_name[0]);
274-
/* fall through */
274+
fallthrough;
275275
case PPTP_START_SESSION_REQUEST:
276276
case PPTP_START_SESSION_REPLY:
277277
case PPTP_STOP_SESSION_REQUEST:

0 commit comments

Comments
 (0)