Skip to content

Commit 48001d2

Browse files
Peter Zijlstraingomolnar
authored andcommitted
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
1 parent d46f61b commit 48001d2

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

tools/objtool/check.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,17 +1225,9 @@ static int handle_jump_alt(struct objtool_file *file,
12251225
struct instruction *orig_insn,
12261226
struct instruction **new_insn)
12271227
{
1228-
if (orig_insn->type == INSN_NOP) {
1229-
do_nop:
1230-
if (orig_insn->len == 2)
1231-
file->jl_nop_short++;
1232-
else
1233-
file->jl_nop_long++;
1228+
if (orig_insn->type != INSN_JUMP_UNCONDITIONAL &&
1229+
orig_insn->type != INSN_NOP) {
12341230

1235-
return 0;
1236-
}
1237-
1238-
if (orig_insn->type != INSN_JUMP_UNCONDITIONAL) {
12391231
WARN_FUNC("unsupported instruction at jump label",
12401232
orig_insn->sec, orig_insn->offset);
12411233
return -1;
@@ -1252,7 +1244,15 @@ static int handle_jump_alt(struct objtool_file *file,
12521244
orig_insn->offset, orig_insn->len,
12531245
arch_nop_insn(orig_insn->len));
12541246
orig_insn->type = INSN_NOP;
1255-
goto do_nop;
1247+
}
1248+
1249+
if (orig_insn->type == INSN_NOP) {
1250+
if (orig_insn->len == 2)
1251+
file->jl_nop_short++;
1252+
else
1253+
file->jl_nop_long++;
1254+
1255+
return 0;
12561256
}
12571257

12581258
if (orig_insn->len == 2)

0 commit comments

Comments
 (0)