diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 6dbcba7f096902462b6d479e3fefe54dad925122..2720600b13a9eac7a73831f4d3b6a8d4a33a8575 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -310,10 +310,11 @@ __add_event(struct list_head *list, int *idx, event_attr_init(attr); - evsel = perf_evsel__new_idx(attr, (*idx)++); + evsel = perf_evsel__new_idx(attr, *idx); if (!evsel) return NULL; + (*idx)++; evsel->cpus = cpu_map__get(cpus); evsel->own_cpus = cpu_map__get(cpus);