From patchwork Sat Jul 15 06:03:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 788846 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3x8fCw5QQ3z9sBR for ; Sat, 15 Jul 2017 16:05:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="AMZGfWGk"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbdGOGEt (ORCPT ); Sat, 15 Jul 2017 02:04:49 -0400 Received: from mail-pg0-f42.google.com ([74.125.83.42]:34566 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751240AbdGOGEs (ORCPT ); Sat, 15 Jul 2017 02:04:48 -0400 Received: by mail-pg0-f42.google.com with SMTP id t186so55108014pgb.1 for ; Fri, 14 Jul 2017 23:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=VcUplUfENJYTwJdVvgYGXuI7xPX0XUHt2Bo9KoCfWeI=; b=AMZGfWGkgjYIuh3G33mfskyiRWaNdE3ZTkJ+K0R2YSpbOJhPS2DADjdFVbMvE2Sn8H jCCbA36SCOXqv1/8jLzLB8byolaoi/GfPAYLkwRjSZ8f6cKSWLUSstPf0i5nAzPDS4tq A5A5lX54S7OIA4cROPT5mxu2dC0W6pjaJeASwMVhhZf6HKTL23qgrI8u8hXx3LtI6eCE 0wBNTVESwBMmwJGoYiEEdBfqQYBMoo94/jaJIpcYpZUK5b/9rQRxXPh0EZ6pcm65fMMT PaTJLzKHZk+2QqbYoKbSDLwKkDR+8KGLWh6NQyLCeYSR27Q/7GzNco6L9IOY0hm7U4vU pbLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VcUplUfENJYTwJdVvgYGXuI7xPX0XUHt2Bo9KoCfWeI=; b=VC4FNINHlZR0rn5OiQdD+VHIOrcTWB1pCSOAvsQRkqcdxw26YuCNYcw1Nx+iJ0sw9J cta9u8tAaxy/6vpPlXCvf+knWnd3r3uqQcYz7cwciU8Oioao4qn+y1dy85tFGD66Dyr7 FFPmBUrWK5Fmyr+Til+N8zxPJuHHM5iqFrXIPp0dOMpIP7R64Z3kqUA2aDEUIDQm+Mgw h097t3d0+Ao9f4km0XXINnHsx9+UQaUaLJXfGVfHxbVqevfuSp9IOUX+Y7AsCoUs9zfG Ve/cKHH2LPk4rGCnolk97UxL8e0C4kqg9NuXekI0f5QfbFikXw8wlmc6n+MRcqlSmxh+ YesA== X-Gm-Message-State: AIVw112YME55ePoz2hSQ5NpI24V0zC0kxxtLx7fJd0l3OvsU5y3AfMnM kmUeBf6UCfcv4mdDLQo= X-Received: by 10.99.96.85 with SMTP id u82mr18723465pgb.214.1500098687515; Fri, 14 Jul 2017 23:04:47 -0700 (PDT) Received: from jkicinski-Precision-T1700.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id i186sm24443223pgd.55.2017.07.14.23.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jul 2017 23:04:46 -0700 (PDT) From: Jakub Kicinski To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kadlec@blackhole.kfki.hu, oss-drivers@netronome.com, Jakub Kicinski Subject: [PATCH net] jhash: fix -Wimplicit-fallthrough warnings Date: Fri, 14 Jul 2017 23:03:49 -0700 Message-Id: <20170715060349.2464-1-jakub.kicinski@netronome.com> X-Mailer: git-send-email 2.11.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org GCC 7 added a new -Wimplicit-fallthrough warning. It's only enabled with W=1, but since linux/jhash.h is included in over hundred places (including other global headers) it seems worthwhile fixing this warning. Signed-off-by: Jakub Kicinski --- If it looks good, would it be OK to take it via the net tree? include/linux/jhash.h | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/include/linux/jhash.h b/include/linux/jhash.h index 348c6f47e4cc..8037850f3104 100644 --- a/include/linux/jhash.h +++ b/include/linux/jhash.h @@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval) k += 12; } /* Last block: affect all 32 bits of (c) */ - /* All the case statements fall through */ switch (length) { - case 12: c += (u32)k[11]<<24; - case 11: c += (u32)k[10]<<16; - case 10: c += (u32)k[9]<<8; - case 9: c += k[8]; - case 8: b += (u32)k[7]<<24; - case 7: b += (u32)k[6]<<16; - case 6: b += (u32)k[5]<<8; - case 5: b += k[4]; - case 4: a += (u32)k[3]<<24; - case 3: a += (u32)k[2]<<16; - case 2: a += (u32)k[1]<<8; + case 12: c += (u32)k[11]<<24; /* fall through */ + case 11: c += (u32)k[10]<<16; /* fall through */ + case 10: c += (u32)k[9]<<8; /* fall through */ + case 9: c += k[8]; /* fall through */ + case 8: b += (u32)k[7]<<24; /* fall through */ + case 7: b += (u32)k[6]<<16; /* fall through */ + case 6: b += (u32)k[5]<<8; /* fall through */ + case 5: b += k[4]; /* fall through */ + case 4: a += (u32)k[3]<<24; /* fall through */ + case 3: a += (u32)k[2]<<16; /* fall through */ + case 2: a += (u32)k[1]<<8; /* fall through */ case 1: a += k[0]; __jhash_final(a, b, c); case 0: /* Nothing left to add */ @@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval) k += 3; } - /* Handle the last 3 u32's: all the case statements fall through */ + /* Handle the last 3 u32's */ switch (length) { - case 3: c += k[2]; - case 2: b += k[1]; + case 3: c += k[2]; /* fall through */ + case 2: b += k[1]; /* fall through */ case 1: a += k[0]; __jhash_final(a, b, c); case 0: /* Nothing left to add */