Commit 13c401f3 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

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: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 533da29b
...@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval) ...@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
k += 12; k += 12;
} }
/* Last block: affect all 32 bits of (c) */ /* Last block: affect all 32 bits of (c) */
/* All the case statements fall through */
switch (length) { switch (length) {
case 12: c += (u32)k[11]<<24; case 12: c += (u32)k[11]<<24; /* fall through */
case 11: c += (u32)k[10]<<16; case 11: c += (u32)k[10]<<16; /* fall through */
case 10: c += (u32)k[9]<<8; case 10: c += (u32)k[9]<<8; /* fall through */
case 9: c += k[8]; case 9: c += k[8]; /* fall through */
case 8: b += (u32)k[7]<<24; case 8: b += (u32)k[7]<<24; /* fall through */
case 7: b += (u32)k[6]<<16; case 7: b += (u32)k[6]<<16; /* fall through */
case 6: b += (u32)k[5]<<8; case 6: b += (u32)k[5]<<8; /* fall through */
case 5: b += k[4]; case 5: b += k[4]; /* fall through */
case 4: a += (u32)k[3]<<24; case 4: a += (u32)k[3]<<24; /* fall through */
case 3: a += (u32)k[2]<<16; case 3: a += (u32)k[2]<<16; /* fall through */
case 2: a += (u32)k[1]<<8; case 2: a += (u32)k[1]<<8; /* fall through */
case 1: a += k[0]; case 1: a += k[0];
__jhash_final(a, b, c); __jhash_final(a, b, c);
case 0: /* Nothing left to add */ case 0: /* Nothing left to add */
...@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval) ...@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
k += 3; k += 3;
} }
/* Handle the last 3 u32's: all the case statements fall through */ /* Handle the last 3 u32's */
switch (length) { switch (length) {
case 3: c += k[2]; case 3: c += k[2]; /* fall through */
case 2: b += k[1]; case 2: b += k[1]; /* fall through */
case 1: a += k[0]; case 1: a += k[0];
__jhash_final(a, b, c); __jhash_final(a, b, c);
case 0: /* Nothing left to add */ case 0: /* Nothing left to add */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment