From: Arnaldo Carvalho de Melo Date: Tue, 27 Nov 2018 14:45:49 +0000 (-0300) Subject: perf env: Also consider env->arch == NULL as local operation X-Git-Tag: v5.15~7352^2~1^2~70 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=804234f27180dcf9a25cb98a88d5212f65b7f3fd;p=platform%2Fkernel%2Flinux-starfive.git perf env: Also consider env->arch == NULL as local operation We'll set a new machine field based on env->arch, which for live mode, like with 'perf top' means we need to use uname() to figure the name of the arch, fix perf_env__arch() to consider both (env == NULL) and (env->arch == NULL) as local operation. Cc: Adrian Hunter Cc: Andi Kleen Cc: David Ahern Cc: David S. Miller Cc: Jiri Olsa Cc: Leo Yan Cc: Mathieu Poirier Cc: Namhyung Kim Cc: Wang Nan Cc: stable@vger.kernel.org # 4.19 Link: https://lkml.kernel.org/n/tip-vcz4ufzdon7cwy8dm2ua53xk@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 59f38c7..4c23779 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -166,7 +166,7 @@ const char *perf_env__arch(struct perf_env *env) struct utsname uts; char *arch_name; - if (!env) { /* Assume local operation */ + if (!env || !env->arch) { /* Assume local operation */ if (uname(&uts) < 0) return NULL; arch_name = uts.machine;