diff options
author | Andi Kleen <ak@linux.intel.com> | 2019-10-20 20:51:55 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-11-06 21:43:05 +0300 |
commit | 2ccfb8bc2143ca347609d1d4434176d73a78d805 (patch) | |
tree | ad11f89aa5f7cf704c4a2dca43d9dd0504eaaa31 /tools/perf/util/evsel.c | |
parent | 796c01a4bfb4b35ec6d1bd1cd5d520515d078b51 (diff) | |
download | linux-2ccfb8bc2143ca347609d1d4434176d73a78d805.tar.xz |
perf evsel: Avoid close(-1)
In some weak fallback cases close can be called a lot with -1. Check for
this case and avoid calling close then.
This is mainly to shut up valgrind which complains about this case.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20191020175202.32456-3-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index d831038b55f2..d4451846af93 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1815,7 +1815,8 @@ out_close: old_errno = errno; do { while (--thread >= 0) { - close(FD(evsel, cpu, thread)); + if (FD(evsel, cpu, thread) >= 0) + close(FD(evsel, cpu, thread)); FD(evsel, cpu, thread) = -1; } thread = nthreads; |