From patchwork Mon Mar 6 09:34:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 94916 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1249537obz; Mon, 6 Mar 2017 01:46:53 -0800 (PST) X-Received: by 10.99.175.67 with SMTP id s3mr19519432pgo.185.1488793613645; Mon, 06 Mar 2017 01:46:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 84si18572619pgd.10.2017.03.06.01.46.53; Mon, 06 Mar 2017 01:46:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754328AbdCFJqk (ORCPT + 25 others); Mon, 6 Mar 2017 04:46:40 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:3472 "EHLO dggrg03-dlp.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754452AbdCFJpy (ORCPT ); Mon, 6 Mar 2017 04:45:54 -0500 Received: from 172.30.72.57 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.57]) by dggrg03-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AJP60915; Mon, 06 Mar 2017 17:38:49 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Mon, 6 Mar 2017 17:38:39 +0800 From: Kefeng Wang To: CC: Peter Zijlstra , Jiri Olsa , Namhyung Kim , Wang Nan , , Kefeng Wang Subject: [PATCH] perf probe: Return errno when does not hit any event Date: Mon, 6 Mar 2017 17:34:51 +0800 Message-ID: <1488792891-57629-1-git-send-email-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.58BD2E29.00B9, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 85e634bf3d27a55d74f04f80a233d14e Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On old perf, when using perf probe -d to delete an inexistent event, it return errno, eg, -bash-4.3# perf probe -d xxx || echo $? Info: Event "*:xxx" does not exist. Error: Failed to delete events. 255 But now perf_del_probe_events() will always set ret = 0, different from previous del_perf_probe_events(). After this, it return errno again, eg, -bash-4.3# ./perf probe -d xxx || echo $? Error: Failed to delete events. 254 And it is more appropriate to return -ENOENT instead of -EPERM. Signed-off-by: Kefeng Wang --- tools/perf/builtin-probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.7.12.4 diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 1fcebc3..c46b41c 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -444,7 +444,8 @@ static int perf_del_probe_events(struct strfilter *filter) if (ret == -ENOENT && ret2 == -ENOENT) pr_debug("\"%s\" does not hit any event.\n", str); /* Note that this is silently ignored */ - ret = 0; + else + ret = 0; error: if (kfd >= 0)