aboutsummaryrefslogtreecommitdiff
path: root/tools/lib/perf
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-27 10:03:28 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-27 10:03:28 +0200
commite6aa42f93751e4d9ac8505b7ac57acd5506bdec9 (patch)
tree3bdbb589c7e0abeb111cdd142f647fd21c762355 /tools/lib/perf
parent508aeb54e4f0225f4ff3da9b7ec8ac44ce30aad8 (diff)
parent03c765b0e3b4cb5063276b086c76f7a612856a9a (diff)
Merge 5.19-rc4 into usb-next
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/lib/perf')
-rw-r--r--tools/lib/perf/evsel.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c
index c1d58673f6ef..952f3520d5c2 100644
--- a/tools/lib/perf/evsel.c
+++ b/tools/lib/perf/evsel.c
@@ -149,23 +149,30 @@ int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus,
int fd, group_fd, *evsel_fd;
evsel_fd = FD(evsel, idx, thread);
- if (evsel_fd == NULL)
- return -EINVAL;
+ if (evsel_fd == NULL) {
+ err = -EINVAL;
+ goto out;
+ }
err = get_group_fd(evsel, idx, thread, &group_fd);
if (err < 0)
- return err;
+ goto out;
fd = sys_perf_event_open(&evsel->attr,
threads->map[thread].pid,
cpu, group_fd, 0);
- if (fd < 0)
- return -errno;
+ if (fd < 0) {
+ err = -errno;
+ goto out;
+ }
*evsel_fd = fd;
}
}
+out:
+ if (err)
+ perf_evsel__close(evsel);
return err;
}