diff options
author | 2025-02-28 14:22:59 -0800 | |
---|---|---|
committer | 2025-03-11 18:55:37 -0700 | |
commit | fe0ce8a9d85a48642880c9b78944cb0d23e779c5 (patch) | |
tree | 842f97d87e5c1fd7ad6cb25b27a259ab373d2326 | |
parent | perf debug: Avoid stack overflow in recursive error message (diff) | |
download | wireguard-linux-fe0ce8a9d85a48642880c9b78944cb0d23e779c5.tar.xz wireguard-linux-fe0ce8a9d85a48642880c9b78944cb0d23e779c5.zip |
perf evlist: Add success path to evlist__create_syswide_maps
Over various refactorings evlist__create_syswide_maps has been made to
only ever return with -ENOMEM. Fix this so that when
perf_evlist__set_maps is successfully called, 0 is returned.
Reviewed-by: Howard Chu <howardchu95@gmail.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20250228222308.626803-3-irogers@google.com
Fixes: 8c0498b6891d7ca5 ("perf evlist: Fix create_syswide_maps() not propagating maps")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-rw-r--r-- | tools/perf/util/evlist.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 43adf6b3d855..49e10d6981ad 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -1373,19 +1373,18 @@ static int evlist__create_syswide_maps(struct evlist *evlist) */ cpus = perf_cpu_map__new_online_cpus(); if (!cpus) - goto out; + return -ENOMEM; threads = perf_thread_map__new_dummy(); - if (!threads) - goto out_put; + if (!threads) { + perf_cpu_map__put(cpus); + return -ENOMEM; + } perf_evlist__set_maps(&evlist->core, cpus, threads); - perf_thread_map__put(threads); -out_put: perf_cpu_map__put(cpus); -out: - return -ENOMEM; + return 0; } int evlist__open(struct evlist *evlist) |