Skip to content

Commit

Permalink
perf annotate: Return errors from disasm_line__parse_powerpc()
Browse files Browse the repository at this point in the history
In disasm_line__parse_powerpc() , return code from function
disasm_line__parse() is ignored. This will result in bad results
if the disasm_line__parse() fails to disasm the line. Use
the return code to fix this.

Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Tested-By: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Link: https://lore.kernel.org/r/20250304154114.62093-2-atrajeev@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
  • Loading branch information
Athira Rajeev authored and Namhyung Kim committed Mar 7, 2025
1 parent dab8c32 commit 4c3f09e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/perf/util/disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,7 @@ static int disasm_line__parse_powerpc(struct disasm_line *dl, struct annotate_ar
char *tmp_raw_insn, *name_raw_insn = skip_spaces(line);
char *name = skip_spaces(name_raw_insn + RAW_BYTES);
int disasm = 0;
int ret = 0;

if (args->options->disassembler_used)
disasm = 1;
Expand All @@ -984,7 +985,7 @@ static int disasm_line__parse_powerpc(struct disasm_line *dl, struct annotate_ar
return -1;

if (disasm)
disasm_line__parse(name, namep, rawp);
ret = disasm_line__parse(name, namep, rawp);
else
*namep = "";

Expand All @@ -998,7 +999,7 @@ static int disasm_line__parse_powerpc(struct disasm_line *dl, struct annotate_ar
if (disasm)
dl->raw.raw_insn = be32_to_cpu(dl->raw.raw_insn);

return 0;
return ret;
}

static void annotation_line__init(struct annotation_line *al,
Expand Down

0 comments on commit 4c3f09e

Please sign in to comment.