Skip to content

Commit 0806eaf

Browse files
Taeunggregkh
authored andcommitted
perf tools: Only increase index if perf_evsel__new_idx() succeeds
[ Upstream commit 75fc5ae5cc53fff71041ecadeb3354a2b4c9fe42 ] Signed-off-by: Taeung Song <treeze.taeung@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1485952447-7013-2-git-send-email-treeze.taeung@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3b7d9a9 commit 0806eaf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/perf/util/parse-events.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,11 @@ __add_event(struct list_head *list, int *idx,
291291

292292
event_attr_init(attr);
293293

294-
evsel = perf_evsel__new_idx(attr, (*idx)++);
294+
evsel = perf_evsel__new_idx(attr, *idx);
295295
if (!evsel)
296296
return NULL;
297297

298+
(*idx)++;
298299
evsel->cpus = cpu_map__get(cpus);
299300
evsel->own_cpus = cpu_map__get(cpus);
300301

0 commit comments

Comments
 (0)