[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-931ef5dc5c18717d24e5b8d8a968e35638508051@git.kernel.org>
Date: Mon, 19 Mar 2018 23:21:50 -0700
From: tip-bot for John Garry <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, zhangshaokun@...ilicon.com, jolsa@...nel.org,
tglx@...utronix.de, ganapatrao.kulkarni@...ium.com,
namhyung@...nel.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, ak@...ux.intel.com, mingo@...nel.org,
john.garry@...wei.com, hpa@...or.com, wcohen@...hat.com,
will.deacon@....com, alexander.shishkin@...ux.intel.com
Subject: [tip:perf/core] perf vendor events: Fix error code in json_events()
Commit-ID: 931ef5dc5c18717d24e5b8d8a968e35638508051
Gitweb: https://git.kernel.org/tip/931ef5dc5c18717d24e5b8d8a968e35638508051
Author: John Garry <john.garry@...wei.com>
AuthorDate: Thu, 8 Mar 2018 18:58:27 +0800
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
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 <john.garry@...wei.com>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@...ium.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Shaokun Zhang <zhangshaokun@...ilicon.com>
Cc: Will Deacon <will.deacon@....com>
Cc: William Cohen <wcohen@...hat.com>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linuxarm@...wei.com
Link: http://lkml.kernel.org/r/1520506716-197429-3-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
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;
Powered by blists - more mailing lists