Skip to contentSkip to conversation

ARC: kgdb: add 'fallthrough' to prevent a warning

PATCH In review Randy Dunlap 2 participants 2 messages Apr 22, 2021 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARC: kgdb: add 'fallthrough' to prevent a warning

Use the 'fallthrough' macro to document that this switch case does indeed fall through to the next case.

../arch/arc/kernel/kgdb.c: In function 'kgdb_arch_handle_exception':
../arch/arc/kernel/kgdb.c:141:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
141 | if (kgdb_hex2long(&ptr, &addr))
| ^
../arch/arc/kernel/kgdb.c:144:2: note: here

  144 |  case 'D':
      |  ^~~~
---
 arch/arc/kernel/kgdb.c |    1 +
 1 file changed, 1 insertion(+)
arch/arc/kernel/kgdb.c +1 -0
@@ -140,6 +140,7 @@ int kgdb_arch_handle_exception(int e_vec
 		ptr = &remcomInBuffer[1];
 		if (kgdb_hex2long(&ptr, &addr))
 			regs->ret = addr;
+		fallthrough;
 
 	case 'D':
 	case 'k':

_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

#1 lore raw
Quoted 8 lines · Randy Dunlap

Use the 'fallthrough' macro to document that this switch case does indeed fall through to the next case.

../arch/arc/kernel/kgdb.c: In function 'kgdb_arch_handle_exception':
../arch/arc/kernel/kgdb.c:141:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
141 | if (kgdb_hex2long(&ptr, &addr))
| ^
../arch/arc/kernel/kgdb.c:144:2: note: here

Quoted 6 lines
   144 |  case 'D':
       |  ^~~~

Thx for the fix Randy. Added to for-curr !

-Vineet

Quoted 14 lines
---
  arch/arc/kernel/kgdb.c |    1 +
  1 file changed, 1 insertion(+)
arch/arc/kernel/kgdb.c +1 -0
@@ -140,6 +140,7 @@ int kgdb_arch_handle_exception(int e_vec
  		ptr = &remcomInBuffer[1];
  		if (kgdb_hex2long(&ptr, &addr))
  			regs->ret = addr;
+		fallthrough;
 
  	case 'D':
  	case 'k':