Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3505798rwj; Mon, 19 Dec 2022 20:23:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXuuKqJfClk/IqpWbGQKhDYjo2Yxt7HFrbKNygEBoqt8KB/yXy98+YpotCyx2cJOlsLvN8x1 X-Received: by 2002:a17:906:34db:b0:78d:f454:ba2c with SMTP id h27-20020a17090634db00b0078df454ba2cmr721091ejb.43.1671510204437; Mon, 19 Dec 2022 20:23:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671510204; cv=none; d=google.com; s=arc-20160816; b=z9UsXhW/LRdfhbDipjFcf6MtX1rT66rVZG2cLLkbRHVW1u2FAxz9DHG5WWfGe88rfN CF4N44WfL5IAlHb2dMwiex9aBK9FLfxv+9XHDKCdHuRvPXPc9wVmzChJjZ1YxsoYUvhj e/jh9zG0Ckk4a+Dow88E93b6dhkNVX08OzjN8FwBHc7Vs0EG8lxQ29frXQzcj2AxNr0E vPo8t3gAc3qzpOihvkOoMC8ezS1q8zkz8eHgyZ6fae4mqHaJHv8dDtk+FO3MZ1JG4KSX +r73r0mTIbWYek2QhErdnRhvZlIca8Ey/uqbYacQsvrGRqwBqrjupb3c1tRdGCU3az57 yzPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=72tEFgv/+w4y8SxpSnAeKXvCHK/PzXkRPXP7tnCOgdg=; b=J2fErslSLOqcp5LllOKyeQHSmWbfF1+9Wp3yQHUKpNqlDfjCH1+WWWiPUEreLL82Vc hK2ll3JcC8m8DnP9Ue0P6U+fwPhmIQbrG3lwt8SAj8/xdbptU209alA3WFqez8lawC5x tNJyYcfZ6PI0Ov4PY8nFlU02OWxFAyYjEDVoUmOEen7TRPPtx370ll7fSkSUXy2kQ/QM A5FRgcWaPJWVA3OXieMEBvwXgeIJp5/081P93XmjqbSU/dgb4Jgx49QaDBSB2dfeVe41 zJTLq2nK7WOsKtJlzFMZeGPGzgyo6V3tYdWPRzBcFKL9lnj+LwF1uqWqeO8L4mEnikZd Tycw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc44-20020a17090716ac00b007bd6264c2dbsi11204100ejc.28.2022.12.19.20.23.07; Mon, 19 Dec 2022 20:23:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233101AbiLTEAB (ORCPT + 70 others); Mon, 19 Dec 2022 23:00:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232989AbiLTD7x (ORCPT ); Mon, 19 Dec 2022 22:59:53 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E03D13E04; Mon, 19 Dec 2022 19:59:52 -0800 (PST) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NbjQk62wKzqT7Z; Tue, 20 Dec 2022 11:55:26 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 20 Dec 2022 11:59:49 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , , CC: Subject: [PATCH 3/3] perf probe: Check -v and -q options in the right place Date: Tue, 20 Dec 2022 11:57:02 +0800 Message-ID: <20221220035702.188413-4-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20221220035702.188413-1-yangjihong1@huawei.com> References: <20221220035702.188413-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 5e17b28f1e24 ("perf probe: Add --quiet option to suppress output result message") Signed-off-by: Yang Jihong --- tools/perf/builtin-probe.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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; -- 2.30.GIT