X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng-context-perf-counters.c;h=5327e6ef06956707a914d15c3d56e9924291d06b;hb=5fe87d9b7e8ad3b11a1841c630865afdd1cd1946;hp=56e0d25035ae7f6a09eec09114ced55524b81159;hpb=f91fd73b8982db34560bf3fe6da9fdf9a42901a9;p=lttng-modules.git diff --git a/lttng-context-perf-counters.c b/lttng-context-perf-counters.c index 56e0d250..5327e6ef 100644 --- a/lttng-context-perf-counters.c +++ b/lttng-context-perf-counters.c @@ -111,7 +111,7 @@ int __cpuinit lttng_perf_counter_cpu_hp_callback(struct notifier_block *nb, case CPU_ONLINE_FROZEN: pevent = perf_event_create_kernel_counter(attr, cpu, NULL, overflow_callback); - if (!pevent) + if (!pevent || IS_ERR(pevent)) return NOTIFY_BAD; barrier(); /* Create perf counter before setting event */ events[cpu] = pevent; @@ -182,7 +182,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, for_each_online_cpu(cpu) { events[cpu] = perf_event_create_kernel_counter(attr, cpu, NULL, overflow_callback); - if (!events[cpu]) { + if (!events[cpu] || IS_ERR(events[cpu])) { ret = -EINVAL; goto counter_error; } @@ -210,7 +210,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, counter_error: for_each_online_cpu(cpu) { - if (events[cpu]) + if (events[cpu] && !IS_ERR(events[cpu])) perf_event_release_kernel(events[cpu]); } put_online_cpus();