Skip to content

Commit 47de447

Browse files
rddunlapMichal Simek
authored andcommitted
microblaze: add 'fallthrough' to memcpy/memset/memmove
Fix "fallthrough" warnings in microblaze memcpy/memset/memmove library functions. CC arch/microblaze/lib/memcpy.o ../arch/microblaze/lib/memcpy.c: In function 'memcpy': ../arch/microblaze/lib/memcpy.c:70:4: warning: this statement may fall through [-Wimplicit-fallthrough=] 70 | --c; ../arch/microblaze/lib/memcpy.c:71:3: note: here 71 | case 2: ../arch/microblaze/lib/memcpy.c:73:4: warning: this statement may fall through [-Wimplicit-fallthrough=] 73 | --c; ../arch/microblaze/lib/memcpy.c:74:3: note: here 74 | case 3: ../arch/microblaze/lib/memcpy.c:178:10: warning: this statement may fall through [-Wimplicit-fallthrough=] 178 | *dst++ = *src++; ../arch/microblaze/lib/memcpy.c:179:2: note: here 179 | case 2: ../arch/microblaze/lib/memcpy.c:180:10: warning: this statement may fall through [-Wimplicit-fallthrough=] 180 | *dst++ = *src++; ../arch/microblaze/lib/memcpy.c:181:2: note: here 181 | case 1: CC arch/microblaze/lib/memset.o ../arch/microblaze/lib/memset.c: In function 'memset': ../arch/microblaze/lib/memset.c:71:4: warning: this statement may fall through [-Wimplicit-fallthrough=] 71 | --n; ../arch/microblaze/lib/memset.c:72:3: note: here 72 | case 2: ../arch/microblaze/lib/memset.c:74:4: warning: this statement may fall through [-Wimplicit-fallthrough=] 74 | --n; ../arch/microblaze/lib/memset.c:75:3: note: here 75 | case 3: CC arch/microblaze/lib/memmove.o ../arch/microblaze/lib/memmove.c: In function 'memmove': ../arch/microblaze/lib/memmove.c:92:4: warning: this statement may fall through [-Wimplicit-fallthrough=] 92 | --c; ../arch/microblaze/lib/memmove.c:93:3: note: here 93 | case 2: ../arch/microblaze/lib/memmove.c:95:4: warning: this statement may fall through [-Wimplicit-fallthrough=] 95 | --c; ../arch/microblaze/lib/memmove.c:96:3: note: here 96 | case 1: ../arch/microblaze/lib/memmove.c:203:10: warning: this statement may fall through [-Wimplicit-fallthrough=] 203 | *--dst = *--src; ../arch/microblaze/lib/memmove.c:204:2: note: here 204 | case 3: ../arch/microblaze/lib/memmove.c:205:10: warning: this statement may fall through [-Wimplicit-fallthrough=] 205 | *--dst = *--src; ../arch/microblaze/lib/memmove.c:206:2: note: here 206 | case 2: ../arch/microblaze/lib/memmove.c:207:10: warning: this statement may fall through [-Wimplicit-fallthrough=] 207 | *--dst = *--src; ../arch/microblaze/lib/memmove.c:208:2: note: here 208 | case 1: Signed-off-by: Randy Dunlap <[email protected]> Cc: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
1 parent bbcee72 commit 47de447

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

arch/microblaze/lib/memcpy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
6868
case 1:
6969
*dst++ = *src++;
7070
--c;
71+
fallthrough;
7172
case 2:
7273
*dst++ = *src++;
7374
--c;
75+
fallthrough;
7476
case 3:
7577
*dst++ = *src++;
7678
--c;
@@ -176,8 +178,10 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
176178
switch (c) {
177179
case 3:
178180
*dst++ = *src++;
181+
fallthrough;
179182
case 2:
180183
*dst++ = *src++;
184+
fallthrough;
181185
case 1:
182186
*dst++ = *src++;
183187
}

arch/microblaze/lib/memmove.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
9090
case 3:
9191
*--dst = *--src;
9292
--c;
93+
fallthrough;
9394
case 2:
9495
*--dst = *--src;
9596
--c;
97+
fallthrough;
9698
case 1:
9799
*--dst = *--src;
98100
--c;
@@ -201,10 +203,13 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
201203
switch (c) {
202204
case 4:
203205
*--dst = *--src;
206+
fallthrough;
204207
case 3:
205208
*--dst = *--src;
209+
fallthrough;
206210
case 2:
207211
*--dst = *--src;
212+
fallthrough;
208213
case 1:
209214
*--dst = *--src;
210215
}

arch/microblaze/lib/memset.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ void *memset(void *v_src, int c, __kernel_size_t n)
6969
case 1:
7070
*src++ = c;
7171
--n;
72+
fallthrough;
7273
case 2:
7374
*src++ = c;
7475
--n;
76+
fallthrough;
7577
case 3:
7678
*src++ = c;
7779
--n;

0 commit comments

Comments
 (0)