Message ID | 20190301132809.24653-11-will.deacon@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Rework debug exception handling code | expand |
On Fri, Mar 01, 2019 at 01:28:09PM +0000, Will Deacon wrote: > brk_handler() now looks pretty strange and can be refactored to drop its > funny 'handler_found' local variable altogether. > > Signed-off-by: Will Deacon <will.deacon@arm.com> Reviewed-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > arch/arm64/kernel/debug-monitors.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c > index 55d46ed6ccc2..480d2fa0ac78 100644 > --- a/arch/arm64/kernel/debug-monitors.c > +++ b/arch/arm64/kernel/debug-monitors.c > @@ -328,14 +328,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; > } > -- > 2.11.0 >
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c index 55d46ed6ccc2..480d2fa0ac78 100644 --- a/arch/arm64/kernel/debug-monitors.c +++ b/arch/arm64/kernel/debug-monitors.c @@ -328,14 +328,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; }
brk_handler() now looks pretty strange and can be refactored to drop its funny 'handler_found' local variable altogether. Signed-off-by: Will Deacon <will.deacon@arm.com> --- arch/arm64/kernel/debug-monitors.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)