All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
	Will Deacon <will.deacon@arm.com>
Subject: [PATCH 10/10] arm64: debug: Clean up brk_handler()
Date: Fri,  1 Mar 2019 13:28:09 +0000	[thread overview]
Message-ID: <20190301132809.24653-11-will.deacon@arm.com> (raw)
In-Reply-To: <20190301132809.24653-1-will.deacon@arm.com>

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(-)

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-03-01 13:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 13:27 [PATCH 00/10] Rework debug exception handling code Will Deacon
2019-03-01 13:28 ` [PATCH 01/10] arm64: debug: Don't propagate UNKNOWN FAR into si_code for debug signals Will Deacon
2019-03-01 13:28   ` Will Deacon
2019-03-01 13:45   ` Mark Rutland
2019-03-01 13:45     ` Mark Rutland
2019-03-05 13:35   ` Sasha Levin
2019-03-01 13:28 ` [PATCH 02/10] arm64: debug: Ensure debug handlers check triggering exception level Will Deacon
2019-03-01 13:28   ` Will Deacon
2019-03-01 13:46   ` Mark Rutland
2019-03-01 13:46     ` Mark Rutland
2019-03-05 13:35   ` Sasha Levin
2019-03-01 13:28 ` [PATCH 03/10] arm64: debug: Remove unused return value from do_debug_exception() Will Deacon
2019-03-01 13:48   ` Mark Rutland
2019-03-01 13:28 ` [PATCH 04/10] arm64: debug: Rename addr parameter for non-watchpoint exception hooks Will Deacon
2019-03-01 13:49   ` Mark Rutland
2019-03-01 13:28 ` [PATCH 05/10] arm64: debug: Remove meaningless comment Will Deacon
2019-03-01 14:08   ` Mark Rutland
2019-03-01 13:28 ` [PATCH 06/10] arm64: debug: Separate debug hooks based on target exception level Will Deacon
2019-03-01 14:07   ` Mark Rutland
2019-03-01 13:28 ` [PATCH 07/10] arm64: kprobes: Avoid calling kprobes debug handlers explicitly Will Deacon
2019-03-01 14:12   ` Mark Rutland
2019-03-01 13:28 ` [PATCH 08/10] arm64: debug: Remove redundant user_mode(regs) checks from debug handlers Will Deacon
2019-03-01 14:13   ` Mark Rutland
2019-03-01 13:28 ` [PATCH 09/10] arm64: probes: Move magic BRK values into brk-imm.h Will Deacon
2019-03-01 14:16   ` Mark Rutland
2019-03-01 13:28 ` Will Deacon [this message]
2019-03-01 14:17   ` [PATCH 10/10] arm64: debug: Clean up brk_handler() Mark Rutland
2019-03-01 16:24 ` [PATCH 00/10] Rework debug exception handling code Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190301132809.24653-11-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.