arm64: debug: Clean up brk_handler()
authorWill Deacon <will.deacon@arm.com>
Tue, 26 Feb 2019 15:39:47 +0000 (15:39 +0000)
committerWill Deacon <will.deacon@arm.com>
Tue, 9 Apr 2019 10:21:13 +0000 (11:21 +0100)
brk_handler() now looks pretty strange and can be refactored to drop its
funny 'handler_found' local variable altogether.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/debug-monitors.c

index 2692a0a27cf3ab3ac79b114fb11fd343ea884dfa..800486cc48239a3c4bb392efe9779eb4fb87a60f 100644 (file)
@@ -331,14 +331,12 @@ NOKPROBE_SYMBOL(call_break_hook);
 static int brk_handler(unsigned long unused, unsigned int esr,
                       struct pt_regs *regs)
 {
-       bool handler_found = false;
-
-       if (!handler_found && call_break_hook(regs, esr) == DBG_HOOK_HANDLED)
-               handler_found = true;
+       if (call_break_hook(regs, esr) == DBG_HOOK_HANDLED)
+               return 0;
 
-       if (!handler_found && user_mode(regs)) {
+       if (user_mode(regs)) {
                send_user_sigtrap(TRAP_BRKPT);
-       } else if (!handler_found) {
+       } else {
                pr_warn("Unexpected kernel BRK exception at EL1\n");
                return -EFAULT;
        }