]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
arm64: debug: clean up single_step_handler logic
authorAda Couprie Diaz <ada.coupriediaz@arm.com>
Mon, 7 Jul 2025 11:40:57 +0000 (12:40 +0100)
committerWill Deacon <will@kernel.org>
Tue, 8 Jul 2025 12:27:41 +0000 (13:27 +0100)
Remove the unnecessary boolean which always checks if the handler was found
and return early instead.

Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@arm.com>
Tested-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20250707114109.35672-2-ada.coupriediaz@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/debug-monitors.c

index 58f047de3e1c5e16199e8d0b1367f5448239b0f7..676fa0231935be5d2883334153200c0cb8dbc053 100644 (file)
@@ -241,8 +241,6 @@ static void send_user_sigtrap(int si_code)
 static int single_step_handler(unsigned long unused, unsigned long esr,
                               struct pt_regs *regs)
 {
-       bool handler_found = false;
-
        /*
         * If we are stepping a pending breakpoint, call the hw_breakpoint
         * handler first.
@@ -250,10 +248,10 @@ static int single_step_handler(unsigned long unused, unsigned long esr,
        if (!reinstall_suspended_bps(regs))
                return 0;
 
-       if (!handler_found && call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
-               handler_found = true;
+       if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
+               return 0;
 
-       if (!handler_found && user_mode(regs)) {
+       if (user_mode(regs)) {
                send_user_sigtrap(TRAP_TRACE);
 
                /*
@@ -263,7 +261,7 @@ static int single_step_handler(unsigned long unused, unsigned long esr,
                 * to the active-not-pending state).
                 */
                user_rewind_single_step(current);
-       } else if (!handler_found) {
+       } else {
                pr_warn("Unexpected kernel single-step exception at EL1\n");
                /*
                 * Re-enable stepping since we know that we will be