linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [tip: objtool/core] objtool: Reflow handle_jump_alt()
       [not found] <rL@hirez.programming.kicks-ass.net>
@ 2021-05-14  7:01 ` tip-bot2 for Peter Zijlstra
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for Peter Zijlstra @ 2021-05-14  7:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Miroslav Benes, Peter Zijlstra (Intel), Ingo Molnar, x86, linux-kernel

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     48001d26c19f02c33795829ec9fc71a0d8d42413
Gitweb:        https://git.kernel.org/tip/48001d26c19f02c33795829ec9fc71a0d8d42413
Author:        Peter Zijlstra <peterz@infradead.org>
AuthorDate:    Thu, 13 May 2021 16:15:50 +02:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 14 May 2021 09:00:10 +02:00

objtool: Reflow handle_jump_alt()

Miroslav figured the code flow in handle_jump_alt() was sub-optimal
with that goto. Reflow the code to make it clearer.

Reported-by: Miroslav Benes <mbenes@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/YJ00lgslY+IpA/rL@hirez.programming.kicks-ass.net
---
 tools/objtool/check.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 2c6a93e..e5947fb 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -1225,17 +1225,9 @@ static int handle_jump_alt(struct objtool_file *file,
 			   struct instruction *orig_insn,
 			   struct instruction **new_insn)
 {
-	if (orig_insn->type == INSN_NOP) {
-do_nop:
-		if (orig_insn->len == 2)
-			file->jl_nop_short++;
-		else
-			file->jl_nop_long++;
+	if (orig_insn->type != INSN_JUMP_UNCONDITIONAL &&
+	    orig_insn->type != INSN_NOP) {
 
-		return 0;
-	}
-
-	if (orig_insn->type != INSN_JUMP_UNCONDITIONAL) {
 		WARN_FUNC("unsupported instruction at jump label",
 			  orig_insn->sec, orig_insn->offset);
 		return -1;
@@ -1252,7 +1244,15 @@ do_nop:
 			       orig_insn->offset, orig_insn->len,
 			       arch_nop_insn(orig_insn->len));
 		orig_insn->type = INSN_NOP;
-		goto do_nop;
+	}
+
+	if (orig_insn->type == INSN_NOP) {
+		if (orig_insn->len == 2)
+			file->jl_nop_short++;
+		else
+			file->jl_nop_long++;
+
+		return 0;
 	}
 
 	if (orig_insn->len == 2)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-14  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <rL@hirez.programming.kicks-ass.net>
2021-05-14  7:01 ` [tip: objtool/core] objtool: Reflow handle_jump_alt() tip-bot2 for Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).