Skip to contentSkip to conversation

sh: kernel: disassemble: Mark expected switch fall-throughs

PATCH In review Gustavo A. R. Silva 4 participants 4 messages Aug 10, 2019 – Aug 13, 2019 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sh: kernel: disassemble: Mark expected switch fall-throughs

Remove logically dead code and mark switch cases where we are expecting to fall through.

Fix the following warnings (Building: defconfig sh):

arch/sh/kernel/disassemble.c:478:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:487:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:496:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

---
Changes in v2:
- Remove logically dead code. Pointed out by Joe Perches.

NOTE: If no one cares, I'll apply this to my tree and queue it up

      for 5.3-rc4.
 arch/sh/kernel/disassemble.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/sh/kernel/disassemble.c +2 -3
index defebf1a9c8a..845543780cc5 100644
@@ -475,8 +475,6 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 				printk("dbr");
 				break;
 			case FD_REG_N:
-				if (0)
-					goto d_reg_n;
 			case F_REG_N:
 				printk("fr%d", rn);
 				break;
@@ -488,7 +486,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 					printk("xd%d", rn & ~1);
 					break;
 				}
-			d_reg_n:
+				/* else, fall through */
 			case D_REG_N:
 				printk("dr%d", rn);
 				break;
@@ -497,6 +495,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 					printk("xd%d", rm & ~1);
 					break;
 				}
+				/* else, fall through */
 			case D_REG_M:
 				printk("dr%d", rm);
 				break;
Signature · 1 line
2.22.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Gustavo A. R. Silva

Remove logically dead code and mark switch cases where we are expecting to fall through.

Fix the following warnings (Building: defconfig sh):

Quoted 8 lines

arch/sh/kernel/disassemble.c:478:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:487:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:496:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Reviewed-by Tested-by on v2 1/1
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 5 lines · Gustavo A. R. Silva

Remove logically dead code and mark switch cases where we are expecting to fall through.

Fix the following warnings (Building: defconfig sh):

Quoted 8 lines

arch/sh/kernel/disassemble.c:478:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:487:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:496:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

Quoted 43 lines

---
Changes in v2:
- Remove logically dead code. Pointed out by Joe Perches.

NOTE: If no one cares, I'll apply this to my tree and queue it up

      for 5.3-rc4.
 arch/sh/kernel/disassemble.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/sh/kernel/disassemble.c +2 -3
index defebf1a9c8a..845543780cc5 100644
@@ -475,8 +475,6 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 				printk("dbr");
 				break;
 			case FD_REG_N:
-				if (0)
-					goto d_reg_n;
 			case F_REG_N:
 				printk("fr%d", rn);
 				break;
@@ -488,7 +486,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 					printk("xd%d", rn & ~1);
 					break;
 				}
-			d_reg_n:
+				/* else, fall through */
 			case D_REG_N:
 				printk("dr%d", rn);
 				break;
@@ -497,6 +495,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 					printk("xd%d", rm & ~1);
 					break;
 				}
+				/* else, fall through */
 			case D_REG_M:
 				printk("dr%d", rm);
 				break;
Signature · 1 line
2.22.0
maintainer
#3 lore raw
In reply to Gustavo A. R. Silva
Quoted 57 lines · Gustavo A. R. Silva

Remove logically dead code and mark switch cases where we are expecting to fall through.

Fix the following warnings (Building: defconfig sh):

arch/sh/kernel/disassemble.c:478:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:487:8: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/sh/kernel/disassemble.c:496:8: warning: this statement may fall through [-Wimplicit-fallthrough=]

---
Changes in v2:
- Remove logically dead code. Pointed out by Joe Perches.

NOTE: If no one cares, I'll apply this to my tree and queue it up

      for 5.3-rc4.
 arch/sh/kernel/disassemble.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/sh/kernel/disassemble.c +2 -3
index defebf1a9c8a..845543780cc5 100644
@@ -475,8 +475,6 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 				printk("dbr");
 				break;
 			case FD_REG_N:
-				if (0)
-					goto d_reg_n;
 			case F_REG_N:
 				printk("fr%d", rn);
 				break;
@@ -488,7 +486,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 					printk("xd%d", rn & ~1);
 					break;
 				}
-			d_reg_n:
+				/* else, fall through */
 			case D_REG_N:
 				printk("dr%d", rn);
 				break;
@@ -497,6 +495,7 @@ static void print_sh_insn(u32 memaddr, u16 insn)
 					printk("xd%d", rm & ~1);
 					break;
 				}
+				/* else, fall through */
 			case D_REG_M:
 				printk("dr%d", rm);
 				break;
Signature · 1 line
2.22.0

Applied sh-next.
Thanks.

Signature · 1 line
Yosinori Sato