Skip to content

Commit ad8b226

Browse files
Ada Couprie Diazwilldeacon
authored andcommitted
arm64: debug: clean up single_step_handler logic
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>
1 parent 19272b3 commit ad8b226

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

arch/arm64/kernel/debug-monitors.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,19 +241,17 @@ static void send_user_sigtrap(int si_code)
241241
static int single_step_handler(unsigned long unused, unsigned long esr,
242242
struct pt_regs *regs)
243243
{
244-
bool handler_found = false;
245-
246244
/*
247245
* If we are stepping a pending breakpoint, call the hw_breakpoint
248246
* handler first.
249247
*/
250248
if (!reinstall_suspended_bps(regs))
251249
return 0;
252250

253-
if (!handler_found && call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
254-
handler_found = true;
251+
if (call_step_hook(regs, esr) == DBG_HOOK_HANDLED)
252+
return 0;
255253

256-
if (!handler_found && user_mode(regs)) {
254+
if (user_mode(regs)) {
257255
send_user_sigtrap(TRAP_TRACE);
258256

259257
/*
@@ -263,7 +261,7 @@ static int single_step_handler(unsigned long unused, unsigned long esr,
263261
* to the active-not-pending state).
264262
*/
265263
user_rewind_single_step(current);
266-
} else if (!handler_found) {
264+
} else {
267265
pr_warn("Unexpected kernel single-step exception at EL1\n");
268266
/*
269267
* Re-enable stepping since we know that we will be

0 commit comments

Comments
 (0)