diff options
author | akpm <akpm@linux-foundation.org> | 2022-06-27 10:31:34 -0700 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-06-27 10:31:34 -0700 |
commit | 46a3b1125308f8f90a065eeecfafd2a96b01a36c (patch) | |
tree | 6e080118fbad5aa217d160cedf02f10108ce3bf2 /tools/lib/perf/evsel.c | |
parent | 6edda04ccc7cfb281d139e352dbd5dd933bd2751 (diff) | |
parent | 03c765b0e3b4cb5063276b086c76f7a612856a9a (diff) |
Merge branch 'master' into mm-stable
Diffstat (limited to 'tools/lib/perf/evsel.c')
-rw-r--r-- | tools/lib/perf/evsel.c | 17 |
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; } |