From 7c0a6144f9a6a53b1cf2f78f09ca35d59d267f1e Mon Sep 17 00:00:00 2001 From: Yang Jihong Date: Tue, 20 Dec 2022 11:57:01 +0800 Subject: perf tools: Fix usage of the verbose variable The data type of the verbose variable is integer and can be negative, replace improperly used cases in a unified manner: 1. if (verbose) => if (verbose > 0) 2. if (!verbose) => if (verbose <= 0) 3. if (XX && verbose) => if (XX && verbose > 0) 4. if (XX && !verbose) => if (XX && verbose <= 0) Reviewed-by: Adrian Hunter Signed-off-by: Yang Jihong Cc: Alexander Shishkin Cc: Andi Kleen Cc: Carsten Haitzler Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Leo Yan Cc: Mark Rutland Cc: Martin KaFai Lau Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Ravi Bangoria Link: https://lore.kernel.org/r/20221220035702.188413-3-yangjihong1@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/bpf_lock_contention.c | 2 +- tools/perf/util/dlfilter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/perf/util') diff --git a/tools/perf/util/bpf_lock_contention.c b/tools/perf/util/bpf_lock_contention.c index 8e1b791dc58f..df8dbb5191b4 100644 --- a/tools/perf/util/bpf_lock_contention.c +++ b/tools/perf/util/bpf_lock_contention.c @@ -215,7 +215,7 @@ int lock_contention_read(struct lock_contention *con) break; } - if (verbose) { + if (verbose > 0) { st->callstack = memdup(stack_trace, stack_size); if (st->callstack == NULL) break; diff --git a/tools/perf/util/dlfilter.c b/tools/perf/util/dlfilter.c index 54e4d4495e00..37beb7530288 100644 --- a/tools/perf/util/dlfilter.c +++ b/tools/perf/util/dlfilter.c @@ -579,7 +579,7 @@ static void list_filters(const char *dirname) if (!get_filter_desc(dirname, entry->d_name, &desc, &long_desc)) continue; printf(" %-36s %s\n", entry->d_name, desc ? desc : ""); - if (verbose) { + if (verbose > 0) { char *p = long_desc; char *line; -- cgit v1.2.3