perf probe: Check -v and -q options in the right place
[ Upstream commit 8b269b75551227796c1ddac2dbdb2ba504158c61 ]
Check the -q and -v options first to return earlier on error.
Before:
# perf probe -q -v test
probe-definition(0): test
symbol:test file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
Error: -v and -q are exclusive.
After:
# perf probe -q -v test
Error: -v and -q are exclusive.
Fixes: 5e17b28f1e
("perf probe: Add --quiet option to suppress output result message")
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Carsten Haitzler <carsten.haitzler@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin KaFai Lau <martin.lau@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/20221220035702.188413-4-yangjihong1@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5d098b5080
commit
59871742b4
@ -612,6 +612,15 @@ __cmd_probe(int argc, const char **argv)
|
||||
|
||||
argc = parse_options(argc, argv, options, probe_usage,
|
||||
PARSE_OPT_STOP_AT_NON_OPTION);
|
||||
|
||||
if (quiet) {
|
||||
if (verbose != 0) {
|
||||
pr_err(" Error: -v and -q are exclusive.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
verbose = -1;
|
||||
}
|
||||
|
||||
if (argc > 0) {
|
||||
if (strcmp(argv[0], "-") == 0) {
|
||||
usage_with_options_msg(probe_usage, options,
|
||||
@ -633,14 +642,6 @@ __cmd_probe(int argc, const char **argv)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (quiet) {
|
||||
if (verbose != 0) {
|
||||
pr_err(" Error: -v and -q are exclusive.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
verbose = -1;
|
||||
}
|
||||
|
||||
if (probe_conf.max_probes == 0)
|
||||
probe_conf.max_probes = MAX_PROBES;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user