[PATCH 02/13] perf tools: Get rid of dso__needs_decompress call in symbol__disassemble

From: Jiri Olsa
Date: Fri Aug 17 2018 - 05:48:26 EST


There's no need to call dso__needs_decompress twice
in the function.

Link: http://lkml.kernel.org/n/tip-4lygwpnkdyed2rtiof4blint@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/util/annotate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index e4268b948e0e..20061cf42288 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1629,6 +1629,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
char symfs_filename[PATH_MAX];
struct kcore_extract kce;
bool delete_extract = false;
+ bool decomp = false;
int stdout_fd[2];
int lineno = 0;
int nline;
@@ -1662,6 +1663,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
tmp, sizeof(tmp)) < 0)
goto out;

+ decomp = true;
strcpy(symfs_filename, tmp);
}

@@ -1748,7 +1750,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
out_remove_tmp:
close(stdout_fd[0]);

- if (dso__needs_decompress(dso))
+ if (decomp)
unlink(symfs_filename);

if (delete_extract)
--
2.17.1