Received: by 10.213.65.68 with SMTP id h4csp157294imn; Mon, 19 Mar 2018 23:24:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELu8NPHyatcUpVbvKqSJv73e95lKaoByFQbxSgjTLHku4DqrJniz5mqPe4rnrNYmMcdHjfnp X-Received: by 10.99.123.80 with SMTP id k16mr11282963pgn.173.1521527058640; Mon, 19 Mar 2018 23:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521527058; cv=none; d=google.com; s=arc-20160816; b=HuXM6O0YfnU2lf3zcTd3NcMZuJ1IJ0WKSI9LGMgeVZWjxhsMwkzdoWcXHFltqZ2Wlg dyjSN+cscfu+2a2myib7SMA84bcXPhU0c2GFuTxZiUSyCBLIoXB28VH1x0PrZ1/MuDU4 YodpaBS90eJQqm8NtjyCd3GUTgVWc6vVfOY4PH7xkCnWvfcJYN51Ahgv8t7xyfTsMwip N1Ni+Cly7ikPSPeEC30oB3fg8DJ0kfkdc+c8/cWJKGUT4RCrUHAjUqklaT3xsXB4wLKt D1XX/giLD7FGJOvC1A+xRRGmuPMfhJz44t83wFHhjvWW9o4v2A/yMXzLXrb5Y8E0gqbK AjGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=KIS3zmoBWB1NDDVLYLbE3RGttI6FJdTvcfMrgsWXMl0=; b=W1INAjvXDdK4lAsrPsnQ0TbiBBG+R9N8Yu1628Jn8YxiplRezvkoF2zmFrZdNk3DCa CZ64ajeNGkjvwa7TBcTXpplXuqs9PUnHqehZz/q4cHCH4IZcrRO3DRP2/yMnRIVaGYkY 1sp2Ipd1F1veKdZmKR/YeLCl+W0md1769N+lLV1Ppe4k155CMY3SC7vhleU6PMAXfK2c kdYooJ+nzt29+DnNhAB4KvE3LDWldur7GqDUcPiJvU26rfop3U5FqYgCegXdDVnUEsiX ekXHEtgtCe8pgE5Gi5+fP02+yX7gkRZCzA06jX8Dst/kqQWa8ITNCN/Afuq78mKaHF3E pUPw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c197si737955pga.513.2018.03.19.23.24.04; Mon, 19 Mar 2018 23:24:18 -0700 (PDT) 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 S1751905AbeCTGWb (ORCPT + 99 others); Tue, 20 Mar 2018 02:22:31 -0400 Received: from terminus.zytor.com ([198.137.202.136]:53733 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751689AbeCTGWY (ORCPT ); Tue, 20 Mar 2018 02:22:24 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2K6Lp9S028751; Mon, 19 Mar 2018 23:21:51 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2K6Lo3P028748; Mon, 19 Mar 2018 23:21:50 -0700 Date: Mon, 19 Mar 2018 23:21:50 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for John Garry Message-ID: Cc: acme@redhat.com, zhangshaokun@hisilicon.com, jolsa@kernel.org, tglx@linutronix.de, ganapatrao.kulkarni@cavium.com, namhyung@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, ak@linux.intel.com, mingo@kernel.org, john.garry@huawei.com, hpa@zytor.com, wcohen@redhat.com, will.deacon@arm.com, alexander.shishkin@linux.intel.com Reply-To: tglx@linutronix.de, namhyung@kernel.org, ganapatrao.kulkarni@cavium.com, peterz@infradead.org, mingo@kernel.org, ak@linux.intel.com, linux-kernel@vger.kernel.org, john.garry@huawei.com, hpa@zytor.com, will.deacon@arm.com, wcohen@redhat.com, alexander.shishkin@linux.intel.com, acme@redhat.com, zhangshaokun@hisilicon.com, jolsa@kernel.org In-Reply-To: <1520506716-197429-3-git-send-email-john.garry@huawei.com> References: <1520506716-197429-3-git-send-email-john.garry@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf vendor events: Fix error code in json_events() Git-Commit-ID: 931ef5dc5c18717d24e5b8d8a968e35638508051 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 931ef5dc5c18717d24e5b8d8a968e35638508051 Gitweb: https://git.kernel.org/tip/931ef5dc5c18717d24e5b8d8a968e35638508051 Author: John Garry AuthorDate: Thu, 8 Mar 2018 18:58:27 +0800 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 16 Mar 2018 13:54:03 -0300 perf vendor events: Fix error code in json_events() When EXPECT macro fails an assertion, the error code is not properly set after the first loop of tokens in function json_events(). This is because err is set to the return value from func function pointer call, which must be 0 to continue to loop, yet it is not reset for for each loop. I assume that this was not the intention, so change the code so err is set appropriately in EXPECT macro itself. In addition to this, the indention in EXPECT macro is tidied. The current indention alludes that the 2 statements following the if statement are in the body, which is not true. Signed-off-by: John Garry Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ganapatrao Kulkarni Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Shaokun Zhang Cc: Will Deacon Cc: William Cohen Cc: linux-arm-kernel@lists.infradead.org Cc: linuxarm@huawei.com Link: http://lkml.kernel.org/r/1520506716-197429-3-git-send-email-john.garry@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/pmu-events/jevents.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 9e0a21e74a67..edff989fbcea 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -249,9 +249,10 @@ static const char *field_to_perf(struct map *table, char *map, jsmntok_t *val) jsmntok_t *loc = (t); \ if (!(t)->start && (t) > tokens) \ loc = (t) - 1; \ - pr_err("%s:%d: " m ", got %s\n", fn, \ - json_line(map, loc), \ - json_name(t)); \ + pr_err("%s:%d: " m ", got %s\n", fn, \ + json_line(map, loc), \ + json_name(t)); \ + err = -EIO; \ goto out_free; \ } } while (0) @@ -416,7 +417,7 @@ int json_events(const char *fn, char *metric_name, char *metric_group), void *data) { - int err = -EIO; + int err; size_t size; jsmntok_t *tokens, *tok; int i, j, len;