Commit d5bc056e authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf evlist: Remove redundant validation from propagate_maps()

The validation checks that the values that were just assigned, got
assigned i.e. the error can't ever happen.  Subsequent patches will call
this code in places where errors are not being returned.  Changing those
code paths to return this non-existent error is counter-productive, so
just remove it.

That in turn results in perf_evlist__set_maps not needing to return an
error, but callers aren't checking it either, so remove that too.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Link: http://lkml.kernel.org/r/1441699142-18905-4-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 725e06b2
...@@ -1103,8 +1103,8 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages, ...@@ -1103,8 +1103,8 @@ int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages,
return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false); return perf_evlist__mmap_ex(evlist, pages, overwrite, 0, false);
} }
static int perf_evlist__propagate_maps(struct perf_evlist *evlist, static void perf_evlist__propagate_maps(struct perf_evlist *evlist,
bool has_user_cpus) bool has_user_cpus)
{ {
struct perf_evsel *evsel; struct perf_evsel *evsel;
...@@ -1119,13 +1119,7 @@ static int perf_evlist__propagate_maps(struct perf_evlist *evlist, ...@@ -1119,13 +1119,7 @@ static int perf_evlist__propagate_maps(struct perf_evlist *evlist,
} }
evsel->threads = thread_map__get(evlist->threads); evsel->threads = thread_map__get(evlist->threads);
if ((evlist->cpus && !evsel->cpus) ||
(evlist->threads && !evsel->threads))
return -ENOMEM;
} }
return 0;
} }
int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
...@@ -1144,7 +1138,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) ...@@ -1144,7 +1138,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
if (evlist->cpus == NULL) if (evlist->cpus == NULL)
goto out_delete_threads; goto out_delete_threads;
return perf_evlist__propagate_maps(evlist, !!target->cpu_list); perf_evlist__propagate_maps(evlist, !!target->cpu_list);
return 0;
out_delete_threads: out_delete_threads:
thread_map__put(evlist->threads); thread_map__put(evlist->threads);
...@@ -1152,9 +1148,8 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target) ...@@ -1152,9 +1148,8 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
return -1; return -1;
} }
int perf_evlist__set_maps(struct perf_evlist *evlist, void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus,
struct cpu_map *cpus, struct thread_map *threads)
struct thread_map *threads)
{ {
cpu_map__put(evlist->cpus); cpu_map__put(evlist->cpus);
evlist->cpus = cpus; evlist->cpus = cpus;
...@@ -1162,7 +1157,7 @@ int perf_evlist__set_maps(struct perf_evlist *evlist, ...@@ -1162,7 +1157,7 @@ int perf_evlist__set_maps(struct perf_evlist *evlist,
thread_map__put(evlist->threads); thread_map__put(evlist->threads);
evlist->threads = threads; evlist->threads = threads;
return perf_evlist__propagate_maps(evlist, false); perf_evlist__propagate_maps(evlist, false);
} }
int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel) int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel)
......
...@@ -155,9 +155,8 @@ int perf_evlist__enable_event_idx(struct perf_evlist *evlist, ...@@ -155,9 +155,8 @@ int perf_evlist__enable_event_idx(struct perf_evlist *evlist,
void perf_evlist__set_selected(struct perf_evlist *evlist, void perf_evlist__set_selected(struct perf_evlist *evlist,
struct perf_evsel *evsel); struct perf_evsel *evsel);
int perf_evlist__set_maps(struct perf_evlist *evlist, void perf_evlist__set_maps(struct perf_evlist *evlist, struct cpu_map *cpus,
struct cpu_map *cpus, struct thread_map *threads);
struct thread_map *threads);
int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target); int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target);
int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel); int perf_evlist__apply_filters(struct perf_evlist *evlist, struct perf_evsel **err_evsel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment