Skip to contentSkip to conversation

riscv: stacktrace: Move register keyword to beginning of declaration

PATCH In review Kefeng Wang 2 participants 2 messages Jan 14, 2021 – Jan 15, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: stacktrace: Move register keyword to beginning of declaration

Using global sp_in_global directly to fix the following warning,

arch/riscv/kernel/stacktrace.c:31:3: warning: ‘register’ is not at beginning of declaration [-Wold-style-declaration]

31 |   const register unsigned long current_sp = sp_in_global;
   |   ^~~~~
---
 arch/riscv/kernel/stacktrace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/kernel/stacktrace.c +2 -3
index 48b870a685b3..df5d2da7c40b 100644
@@ -14,7 +14,7 @@
 
 #include <asm/stacktrace.h>
 
-register unsigned long sp_in_global __asm__("sp");
+register const unsigned long sp_in_global __asm__("sp");
 
 #ifdef CONFIG_FRAME_POINTER
 
@@ -28,9 +28,8 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
 		sp = user_stack_pointer(regs);
 		pc = instruction_pointer(regs);
 	} else if (task == NULL || task == current) {
-		const register unsigned long current_sp = sp_in_global;
 		fp = (unsigned long)__builtin_frame_address(0);
-		sp = current_sp;
+		sp = sp_in_global;
 		pc = (unsigned long)walk_stackframe;
 	} else {
 		/* task blocked in __switch_to */
Signature · 7 lines
2.26.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
maintainer
#1 lore raw
Quoted 25 lines · On Wed, 13 Jan 2021 18:46:57 PST (-0800), [email protected] wrote:

Using global sp_in_global directly to fix the following warning,

arch/riscv/kernel/stacktrace.c:31:3: warning: ‘register’ is not at beginning of declaration [-Wold-style-declaration]

31 |   const register unsigned long current_sp = sp_in_global;
   |   ^~~~~
---
 arch/riscv/kernel/stacktrace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/riscv/kernel/stacktrace.c +1 -1
index 48b870a685b3..df5d2da7c40b 100644
@@ -14,7 +14,7 @@
 
 #include <asm/stacktrace.h>
 
-register unsigned long sp_in_global __asm__("sp");
+register const unsigned long sp_in_global __asm__("sp");
 
 #ifdef CONFIG_FRAME_POINTER
 

arch/riscv/kernel/stacktrace.c void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, · line 35

Quoted 10 lines
arch/riscv/kernel/stacktrace.c +1 -2
@@ -28,9 +28,8 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
 		sp = user_stack_pointer(regs);
 		pc = instruction_pointer(regs);
 	} else if (task == NULL || task == current) {
-		const register unsigned long current_sp = sp_in_global;
 		fp = (unsigned long)__builtin_frame_address(0);
-		sp = current_sp;
+		sp = sp_in_global;
 		pc = (unsigned long)walk_stackframe;
 	} else {
 		/* task blocked in __switch_to */

Thanks, this is on fixes.

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