X-Git-Url: https://jxself.org/git/?p=b43-tools.git;a=blobdiff_plain;f=assembler%2Fmain.c;h=3f207baf1ed69e412d4f5a6be1c48e05a52c6607;hp=774f8f956dc5ad40ded7e40b7ba49079a43f4072;hb=15e6569e86bfc42db9932b3e817161c13d083252;hpb=f9562faebded909074edeff5269cd7f3e122a012 diff --git a/assembler/main.c b/assembler/main.c index 774f8f9..3f207ba 100644 --- a/assembler/main.c +++ b/assembler/main.c @@ -816,13 +816,16 @@ static void assemble_instruction(struct assembler_context *ctx, do_assemble_insn(ctx, insn, 0x002); break; case OP_RET: - if (!list_empty(&ctx->output)) { - /* Get the previous instruction and check whether it - * is a jump instruction. */ - out = list_entry(ctx->output.prev, struct code_output, list); - if (out->is_jump_insn) { - asm_error(ctx, "RET instruction directly after " - "jump instruction. The hardware won't like this."); + /* Get the previous instruction and check whether it + * is a jump instruction. */ + list_for_each_entry_reverse(out, &ctx->output, list) { + /* Search the last insn. */ + if (out->type == OUT_INSN) { + if (out->is_jump_insn) { + asm_error(ctx, "RET instruction directly after " + "jump instruction. The hardware won't like this."); + } + break; } } do_assemble_insn(ctx, insn, 0x003);