From patchwork Sun Oct 15 17:55:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 826034 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yFV7Q25q7z9sBZ for ; Mon, 16 Oct 2017 05:18:10 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751358AbdJOSPy (ORCPT ); Sun, 15 Oct 2017 14:15:54 -0400 Received: from gateway30.websitewelcome.com ([192.185.198.26]:17359 "EHLO gateway30.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751261AbdJOSPx (ORCPT ); Sun, 15 Oct 2017 14:15:53 -0400 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 959E164DA for ; Sun, 15 Oct 2017 12:55:26 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 3n8IeHM7Ituxm3n8IeiKEt; Sun, 15 Oct 2017 12:55:26 -0500 Received: from [189.175.13.173] (port=46182 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1e3n8I-000ZaK-7c; Sun, 15 Oct 2017 12:55:26 -0500 Date: Sun, 15 Oct 2017 12:55:23 -0500 From: "Gustavo A. R. Silva" To: Ilya Dryomov , "Yan, Zheng" , Sage Weil , "David S. Miller" Cc: ceph-devel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] net: ceph: mark expected switch fall-throughs Message-ID: <20171015175523.GA4705@embeddedor.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.175.13.173 X-Exim-ID: 1e3n8I-000ZaK-7c X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.175.13.173]:46182 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 6 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva --- net/ceph/ceph_hash.c | 12 +++++++++++- net/ceph/messenger.c | 1 + net/ceph/mon_client.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/net/ceph/ceph_hash.c b/net/ceph/ceph_hash.c index 67bb1f1..9a5850f2 100644 --- a/net/ceph/ceph_hash.c +++ b/net/ceph/ceph_hash.c @@ -47,28 +47,38 @@ unsigned int ceph_str_hash_rjenkins(const char *str, unsigned int length) /* handle the last 11 bytes */ c = c + length; - switch (len) { /* all the case statements fall through */ + switch (len) { case 11: c = c + ((__u32)k[10] << 24); + /* fall through */ case 10: c = c + ((__u32)k[9] << 16); + /* fall through */ case 9: c = c + ((__u32)k[8] << 8); /* the first byte of c is reserved for the length */ + /* fall through */ case 8: b = b + ((__u32)k[7] << 24); + /* fall through */ case 7: b = b + ((__u32)k[6] << 16); + /* fall through */ case 6: b = b + ((__u32)k[5] << 8); + /* fall through */ case 5: b = b + k[4]; + /* fall through */ case 4: a = a + ((__u32)k[3] << 24); + /* fall through */ case 3: a = a + ((__u32)k[2] << 16); + /* fall through */ case 2: a = a + ((__u32)k[1] << 8); + /* fall through */ case 1: a = a + k[0]; /* case 0: nothing left to add */ diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index a67298c..73dac9d 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -429,6 +429,7 @@ static void ceph_sock_state_change(struct sock *sk) switch (sk->sk_state) { case TCP_CLOSE: dout("%s TCP_CLOSE\n", __func__); + /* fall through */ case TCP_CLOSE_WAIT: dout("%s TCP_CLOSE_WAIT\n", __func__); con_sock_state_closing(con); diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 63edc6e..b97c047 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -1281,6 +1281,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, * request had a non-zero tid. Workaround this weirdness * by falling through to the allocate case. */ + /* fall through */ case CEPH_MSG_MON_MAP: case CEPH_MSG_MDS_MAP: case CEPH_MSG_OSD_MAP: