[PATCH 1/3] perf/core: check return value of perf_event_read IPI

From: David Carrillo-Cisneros
Date: Tue Aug 02 2016 - 00:37:21 EST


The call to smp_call_function_single in perf_event_read() may fail and,
when it does, its error value is the one to return.

Signed-off-by: David Carrillo-Cisneros <davidcc@xxxxxxxxxx>
Reviewed-by: Stephane Eranian <eranian@xxxxxxxxxx>
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 9345028..ebc187f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3469,9 +3469,9 @@ static int perf_event_read(struct perf_event *event, bool group)
.group = group,
.ret = 0,
};
- smp_call_function_single(event->oncpu,
- __perf_event_read, &data, 1);
+ ret = smp_call_function_single(event->oncpu,
+ __perf_event_read, &data, 1);
- ret = data.ret;
+ ret = ret ? : data.ret;
} else if (event->state == PERF_EVENT_STATE_INACTIVE) {
struct perf_event_context *ctx = event->ctx;
unsigned long flags;
--
2.8.0.rc3.226.g39d4020