Skip to contentSkip to conversation

lib/x86/desc: Remove unused variable "exception"

PATCH In review Thomas Huth 1 participant 2 messages Nov 11 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/x86/desc: Remove unused variable "exception"

The variable used to be the return value for test_for_exception(), but commit 932ba2d2f530 ("x86: simplify test_for_exception trigger functions"), changed the logic of that function, so that it is now unused. Clang from Fedora 45 started to complain about this:

lib/x86/desc.c:483:13: error: variable 'exception' set but not used
[-Werror,-Wunused-but-set-global]
483 | static bool exception;
| ^
1 error generated.

Remove it to fix the problem.

Fixes 932ba2d2f530 ("x86: simplify test_for_exception trigger functions")
---
 lib/x86/desc.c | 2 --
 1 file changed, 2 deletions(-)
lib/x86/desc.c +0 -2
index f4cdfbc9..b5d40562 100644
@@ -480,7 +480,6 @@ void setup_alt_stack(void)
 }
 #endif
 
-static bool exception;
 static jmp_buf *exception_jmpbuf;
 
 static void exception_handler_longjmp(void)
@@ -491,7 +490,6 @@ static void exception_handler_longjmp(void)
 static void exception_handler(struct ex_regs *regs)
 {
 	/* longjmp must happen after iret, so do not do it now.  */
-	exception = true;
 	regs->rip = (unsigned long)&exception_handler_longjmp;
 	regs->cs = read_cs();
 }
Signature · 1 line
2.56.0
#1 lore raw

Am 11.11.26 um 09:18 schrieb Thomas Huth:

Quoted 11 lines

The variable used to be the return value for test_for_exception(), but commit 932ba2d2f530 ("x86: simplify test_for_exception trigger functions"), changed the logic of that function, so that it is now unused. Clang from Fedora 45 started to complain about this:

lib/x86/desc.c:483:13: error: variable 'exception' set but not used
[-Werror,-Wunused-but-set-global]

    483 | static bool exception;
        |             ^

1 error generated.

Quoted 7 lines

Remove it to fix the problem.

Fixes 932ba2d2f530 ("x86: simplify test_for_exception trigger functions")
---
  lib/x86/desc.c | 2 --
  1 file changed, 2 deletions(-)

Never mind, I just saw that a patch for this has already been posted three weeks ago:

https://lore.kernel.org/kvm/[email protected]/

Thomas