Skip to contentSkip to conversation

mips: remove unused variable 'prev_state'

PATCH In review Xu Jia 3 participants 3 messages Mar 31, 2021

Subsystems (2)
lore
Share & tools
lore

Xu Jia

author
#0 lore raw

PATCH 1/1 mips: remove unused variable 'prev_state'

GCC reports the following warning with W=1:

arch/mips/kernel/traps.c:1593:17: warning:
variable 'prev_state' set but not used [-Wunused-but-set-variable]

 1593 |  enum ctx_state prev_state;
      |                 ^~~~~~~~~~

This variable is not used in function , this commit remove it to fix the warning.

---
 arch/mips/kernel/traps.c | 2 --
 1 file changed, 2 deletions(-)
arch/mips/kernel/traps.c +0 -2
index 808b8b61ded1..d1f23ddf0c8c 100644
@@ -1590,10 +1590,8 @@ asmlinkage void do_watch(struct pt_regs *regs)
 asmlinkage void do_mcheck(struct pt_regs *regs)
 {
 	int multi_match = regs->cp0_status & ST0_TS;
-	enum ctx_state prev_state;
 	mm_segment_t old_fs = get_fs();
 
-	prev_state = exception_enter();
 	show_regs(regs);
 
 	if (multi_match) {
#1 lore raw
Quoted 21 lines · Xu Jia

GCC reports the following warning with W=1:

arch/mips/kernel/traps.c:1593:17: warning:
variable 'prev_state' set but not used [-Wunused-but-set-variable]

 1593 |  enum ctx_state prev_state;
      |                 ^~~~~~~~~~

This variable is not used in function , this commit remove it to fix the warning.

---
 arch/mips/kernel/traps.c | 2 --
 1 file changed, 2 deletions(-)
arch/mips/kernel/traps.c +0 -0
index 808b8b61ded1..d1f23ddf0c8c 100644

arch/mips/kernel/traps.c asmlinkage void do_watch(struct pt_regs *regs) · line 1596

Quoted 7 lines
arch/mips/kernel/traps.c +0 -2
@@ -1590,10 +1590,8 @@ asmlinkage void do_watch(struct pt_regs *regs)
 asmlinkage void do_mcheck(struct pt_regs *regs)
 {
 	int multi_match = regs->cp0_status & ST0_TS;
-	enum ctx_state prev_state;
 	mm_segment_t old_fs = get_fs();
 
-	prev_state = exception_enter();

The call to exception_enter() is required for context tracking, so removing this call is not the correct solution.

Quoted 4 lines
arch/mips/kernel/traps.c +0 -0
 	show_regs(regs);
 
 	if (multi_match) {
#2 lore raw
In reply to Xu Jia
Quoted 21 lines · Xu Jia

GCC reports the following warning with W=1:

arch/mips/kernel/traps.c:1593:17: warning:
variable 'prev_state' set but not used [-Wunused-but-set-variable]

 1593 |  enum ctx_state prev_state;
      |                 ^~~~~~~~~~

This variable is not used in function , this commit remove it to fix the warning.

---
 arch/mips/kernel/traps.c | 2 --
 1 file changed, 2 deletions(-)
arch/mips/kernel/traps.c +0 -0
index 808b8b61ded1..d1f23ddf0c8c 100644

arch/mips/kernel/traps.c asmlinkage void do_watch(struct pt_regs *regs) · line 1596

Quoted 7 lines
arch/mips/kernel/traps.c +0 -2
@@ -1590,10 +1590,8 @@ asmlinkage void do_watch(struct pt_regs *regs)
 asmlinkage void do_mcheck(struct pt_regs *regs)
 {
 	int multi_match = regs->cp0_status & ST0_TS;
-	enum ctx_state prev_state;
 	mm_segment_t old_fs = get_fs();
 
-	prev_state = exception_enter();

Pretty sure the exception_enter() is still required...

arch/mips/kernel/traps.c asmlinkage void do_watch(struct pt_regs *regs) · line 1595

Quoted 1 line
arch/mips/kernel/traps.c +0 -0
 	show_regs(regs);

regards,
dan carpenter