perf evsel: Propagate error info from tp_format
Propagate error info from tp_format via ERR_PTR to get it all the way down to the parse-event.c tracepoint adding routines. Following functions now return pointer with encoded error: - tp_format - trace_event__tp_format - perf_evsel__newtp_idx - perf_evsel__newtp This affects several other places in perf, that cannot use pointer check anymore, but must utilize the err.h interface, when getting error information from above functions list. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Raphael Beamonte <raphael.beamonte@gmail.com> Link: http://lkml.kernel.org/r/1441615087-13886-5-git-send-email-jolsa@kernel.org [ Add two missing ERR_PTR() and one IS_ERR() ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
e2f9f8ea6a
commit
8dd2a1317e
@@ -1,3 +1,4 @@
|
||||
#include <linux/err.h>
|
||||
#include <traceevent/event-parse.h>
|
||||
#include "evsel.h"
|
||||
#include "tests.h"
|
||||
@@ -36,8 +37,8 @@ int test__perf_evsel__tp_sched_test(void)
|
||||
struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch");
|
||||
int ret = 0;
|
||||
|
||||
if (evsel == NULL) {
|
||||
pr_debug("perf_evsel__new\n");
|
||||
if (IS_ERR(evsel)) {
|
||||
pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -66,6 +67,11 @@ int test__perf_evsel__tp_sched_test(void)
|
||||
|
||||
evsel = perf_evsel__newtp("sched", "sched_wakeup");
|
||||
|
||||
if (IS_ERR(evsel)) {
|
||||
pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (perf_evsel__test_field(evsel, "comm", 16, true))
|
||||
ret = -1;
|
||||
|
||||
|
Reference in New Issue
Block a user