This is a note to let you know that I've just added the patch titled perf probe: Check -v and -q options in the right place to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: perf-probe-check-v-and-q-options-in-the-right-place.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f9eb3ca979bfda6748755a0e13e18263da4aa07d Author: Yang Jihong <yangjihong1@xxxxxxxxxx> Date: Tue Dec 20 11:57:02 2022 +0800 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: 5e17b28f1e246b98 ("perf probe: Add --quiet option to suppress output result message") Reviewed-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> Signed-off-by: Yang Jihong <yangjihong1@xxxxxxxxxx> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx> Cc: Carsten Haitzler <carsten.haitzler@xxxxxxx> Cc: Ian Rogers <irogers@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: Leo Yan <leo.yan@xxxxxxxxxx> Cc: Mark Rutland <mark.rutland@xxxxxxx> Cc: Martin KaFai Lau <martin.lau@xxxxxxxxxx> Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx> Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Cc: Namhyung Kim <namhyung@xxxxxxxxxx> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx> Cc: Ravi Bangoria <ravi.bangoria@xxxxxxx> Link: https://lore.kernel.org/r/20221220035702.188413-4-yangjihong1@xxxxxxxxxx Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 2ae50fc9e597..ed73d0b89ca2 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -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;