From: Ian Rogers Date: Wed, 18 Sep 2024 22:31:16 +0000 (+0200) Subject: perf evsel: Reduce a variables scope X-Git-Tag: v6.13-rc1~68^2~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1b305dc8d74114abd544b0c11397ceb9ded528;p=thirdparty%2Fkernel%2Fstable.git perf evsel: Reduce a variables scope In __evsel__config_callchain avoid computing arch until code path that uses it. Signed-off-by: Ian Rogers Cc: Dominique Martinet Cc: Ze Gao Cc: Yang Jihong Cc: Weilin Wang Link: https://lore.kernel.org/r/20240918223116.127386-1-irogers@google.com Signed-off-by: Namhyung Kim --- diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index edfb376f06119..da0bada62140d 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -859,7 +859,6 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o { bool function = evsel__is_function_event(evsel); struct perf_event_attr *attr = &evsel->core.attr; - const char *arch = perf_env__arch(evsel__env(evsel)); evsel__set_sample_bit(evsel, CALLCHAIN); @@ -890,6 +889,8 @@ static void __evsel__config_callchain(struct evsel *evsel, struct record_opts *o if (param->record_mode == CALLCHAIN_DWARF) { if (!function) { + const char *arch = perf_env__arch(evsel__env(evsel)); + evsel__set_sample_bit(evsel, REGS_USER); evsel__set_sample_bit(evsel, STACK_USER); if (opts->sample_user_regs &&