Skip to contentSkip to conversation

x86_64,kgdb: add default case into a switch

PATCH In review Namhyung Kim 2 participants 3 messages Nov 22, 2010 – Nov 23, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86_64,kgdb: add default case into a switch

This fixes following sparse warning on x86_64:

arch/x86/kernel/kgdb.c:123:9: warning: switch with no cases

---
 arch/x86/kernel/kgdb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/kgdb.c +2 -0
index cd21b65..6919506 100644
@@ -135,6 +135,8 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		*(unsigned long *)mem = 0xFFFF;
 		break;
 #endif
+	default:
+		break;
 	}
 	return dbg_reg_def[regno].name;
 }
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 4 lines · Namhyung Kim

This fixes following sparse warning on x86_64:

arch/x86/kernel/kgdb.c:123:9: warning: switch with no cases

Thanks for the report on this.

The preferred fix for the warning is below, and I'll queue it for the 2.6.38 merge window.

Thanks,
Jason.

--

From: Jason Wessel <[email protected]>
Subject: [PATCH] kgdb,x86_64: fix compile warning found with sparse
Date: Mon Nov 22 08:38:04 CST 2010

Fix sparse warning:

arch/x86/kernel/kgdb.c:123:9: warning: switch with no cases

---
 arch/x86/kernel/kgdb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/kgdb.c +2 -2
@@ -120,8 +120,8 @@ char *dbg_get_reg(int regno, void *mem, 
 		memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
 		       dbg_reg_def[regno].size);
 
-	switch (regno) {
 #ifdef CONFIG_X86_32
+	switch (regno) {
 	case GDB_SS:
 		if (!user_mode_vm(regs))
 			*(unsigned long *)mem = __KERNEL_DS;
@@ -134,8 +134,8 @@ char *dbg_get_reg(int regno, void *mem, 
 	case GDB_FS:
 		*(unsigned long *)mem = 0xFFFF;
 		break;
-#endif
 	}
+#endif
 	return dbg_reg_def[regno].name;
 }
 
#2 lore raw

2010-11-22 (월), 08:39 -0600, Jason Wessel:

Quoted 6 lines · Namhyung Kim
Quoted 4 lines

This fixes following sparse warning on x86_64:

arch/x86/kernel/kgdb.c:123:9: warning: switch with no cases

Quoted 6 lines

Thanks for the report on this.

The preferred fix for the warning is below, and I'll queue it for the 2.6.38 merge window.

Thanks,
Jason.

Looks good to me, thanks.

Signature · 2 lines
Regards,
Namhyung Kim