Skip to content

Commit 13c401f

Browse files
Jakub Kicinskidavem330
authored andcommitted
jhash: fix -Wimplicit-fallthrough warnings
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 <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 533da29 commit 13c401f

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

include/linux/jhash.h

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
8585
k += 12;
8686
}
8787
/* Last block: affect all 32 bits of (c) */
88-
/* All the case statements fall through */
8988
switch (length) {
90-
case 12: c += (u32)k[11]<<24;
91-
case 11: c += (u32)k[10]<<16;
92-
case 10: c += (u32)k[9]<<8;
93-
case 9: c += k[8];
94-
case 8: b += (u32)k[7]<<24;
95-
case 7: b += (u32)k[6]<<16;
96-
case 6: b += (u32)k[5]<<8;
97-
case 5: b += k[4];
98-
case 4: a += (u32)k[3]<<24;
99-
case 3: a += (u32)k[2]<<16;
100-
case 2: a += (u32)k[1]<<8;
89+
case 12: c += (u32)k[11]<<24; /* fall through */
90+
case 11: c += (u32)k[10]<<16; /* fall through */
91+
case 10: c += (u32)k[9]<<8; /* fall through */
92+
case 9: c += k[8]; /* fall through */
93+
case 8: b += (u32)k[7]<<24; /* fall through */
94+
case 7: b += (u32)k[6]<<16; /* fall through */
95+
case 6: b += (u32)k[5]<<8; /* fall through */
96+
case 5: b += k[4]; /* fall through */
97+
case 4: a += (u32)k[3]<<24; /* fall through */
98+
case 3: a += (u32)k[2]<<16; /* fall through */
99+
case 2: a += (u32)k[1]<<8; /* fall through */
101100
case 1: a += k[0];
102101
__jhash_final(a, b, c);
103102
case 0: /* Nothing left to add */
@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
131130
k += 3;
132131
}
133132

134-
/* Handle the last 3 u32's: all the case statements fall through */
133+
/* Handle the last 3 u32's */
135134
switch (length) {
136-
case 3: c += k[2];
137-
case 2: b += k[1];
135+
case 3: c += k[2]; /* fall through */
136+
case 2: b += k[1]; /* fall through */
138137
case 1: a += k[0];
139138
__jhash_final(a, b, c);
140139
case 0: /* Nothing left to add */

0 commit comments

Comments
 (0)