From: Jiri Olsa Date: Fri, 17 Aug 2018 09:48:03 +0000 (+0200) Subject: perf tools: Get rid of dso__needs_decompress() call in __open_dso() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d68a29c2823ff6bd7a25cb748b577f2d88c1f47a;p=linux.git perf tools: Get rid of dso__needs_decompress() call in __open_dso() There's no need to call dso__needs_decompress() twice in the function. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: David Ahern Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180817094813.15086-4-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 51cf82cf18822..8ee1faa5726f5 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -468,6 +468,7 @@ static int __open_dso(struct dso *dso, struct machine *machine) int fd = -EINVAL; char *root_dir = (char *)""; char *name = malloc(PATH_MAX); + bool decomp = false; if (!name) return -ENOMEM; @@ -491,12 +492,13 @@ static int __open_dso(struct dso *dso, struct machine *machine) goto out; } + decomp = true; strcpy(name, newpath); } fd = do_open(name); - if (dso__needs_decompress(dso)) + if (decomp) unlink(name); out: