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 <[email protected]> Tested-by: Luis Claudio R. Goncalves <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Acked-by: Mark Rutland <[email protected]> Reviewed-by: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 19272b3 commit ad8b226

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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)