diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-09-07 04:38:06 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-15 08:48:33 -0400 |
commit | 8dd2a1317eba2c207632dcb19adb7cb746861652 (patch) | |
tree | 15d062f65152a883e2dd459f397bbcf5b1cffe68 | |
parent | e2f9f8ea6a54e252e3a94a5c2321f673b5b97360 (diff) |
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>
-rw-r--r-- | tools/perf/builtin-trace.c | 19 | ||||
-rw-r--r-- | tools/perf/tests/evsel-tp-sched.c | 10 | ||||
-rw-r--r-- | tools/perf/tests/mmap-basic.c | 3 | ||||
-rw-r--r-- | tools/perf/tests/openat-syscall-all-cpus.c | 3 | ||||
-rw-r--r-- | tools/perf/tests/openat-syscall-tp-fields.c | 3 | ||||
-rw-r--r-- | tools/perf/tests/openat-syscall.c | 3 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 3 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 16 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 3 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 6 | ||||
-rw-r--r-- | tools/perf/util/trace-event.c | 15 |
11 files changed, 60 insertions, 24 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 215653274102..93b80f12f35e 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <sys/mman.h> | 39 | #include <sys/mman.h> |
40 | #include <linux/futex.h> | 40 | #include <linux/futex.h> |
41 | #include <linux/err.h> | ||
41 | 42 | ||
42 | /* For older distros: */ | 43 | /* For older distros: */ |
43 | #ifndef MAP_STACK | 44 | #ifndef MAP_STACK |
@@ -245,13 +246,14 @@ static struct perf_evsel *perf_evsel__syscall_newtp(const char *direction, void | |||
245 | struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); | 246 | struct perf_evsel *evsel = perf_evsel__newtp("raw_syscalls", direction); |
246 | 247 | ||
247 | /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */ | 248 | /* older kernel (e.g., RHEL6) use syscalls:{enter,exit} */ |
248 | if (evsel == NULL) | 249 | if (IS_ERR(evsel)) |
249 | evsel = perf_evsel__newtp("syscalls", direction); | 250 | evsel = perf_evsel__newtp("syscalls", direction); |
250 | 251 | ||
251 | if (evsel) { | 252 | if (IS_ERR(evsel)) |
252 | if (perf_evsel__init_syscall_tp(evsel, handler)) | 253 | return NULL; |
253 | goto out_delete; | 254 | |
254 | } | 255 | if (perf_evsel__init_syscall_tp(evsel, handler)) |
256 | goto out_delete; | ||
255 | 257 | ||
256 | return evsel; | 258 | return evsel; |
257 | 259 | ||
@@ -1705,12 +1707,12 @@ static int trace__read_syscall_info(struct trace *trace, int id) | |||
1705 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); | 1707 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name); |
1706 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); | 1708 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); |
1707 | 1709 | ||
1708 | if (sc->tp_format == NULL && sc->fmt && sc->fmt->alias) { | 1710 | if (IS_ERR(sc->tp_format) && sc->fmt && sc->fmt->alias) { |
1709 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias); | 1711 | snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->fmt->alias); |
1710 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); | 1712 | sc->tp_format = trace_event__tp_format("syscalls", tp_name); |
1711 | } | 1713 | } |
1712 | 1714 | ||
1713 | if (sc->tp_format == NULL) | 1715 | if (IS_ERR(sc->tp_format)) |
1714 | return -1; | 1716 | return -1; |
1715 | 1717 | ||
1716 | sc->args = sc->tp_format->format.fields; | 1718 | sc->args = sc->tp_format->format.fields; |
@@ -2390,7 +2392,8 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); | |||
2390 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) | 2392 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) |
2391 | { | 2393 | { |
2392 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); | 2394 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); |
2393 | if (evsel == NULL) | 2395 | |
2396 | if (IS_ERR(evsel)) | ||
2394 | return false; | 2397 | return false; |
2395 | 2398 | ||
2396 | if (perf_evsel__field(evsel, "pathname") == NULL) { | 2399 | if (perf_evsel__field(evsel, "pathname") == NULL) { |
diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index 52162425c969..790e413d9a1f 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/err.h> | ||
1 | #include <traceevent/event-parse.h> | 2 | #include <traceevent/event-parse.h> |
2 | #include "evsel.h" | 3 | #include "evsel.h" |
3 | #include "tests.h" | 4 | #include "tests.h" |
@@ -36,8 +37,8 @@ int test__perf_evsel__tp_sched_test(void) | |||
36 | struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch"); | 37 | struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch"); |
37 | int ret = 0; | 38 | int ret = 0; |
38 | 39 | ||
39 | if (evsel == NULL) { | 40 | if (IS_ERR(evsel)) { |
40 | pr_debug("perf_evsel__new\n"); | 41 | pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel)); |
41 | return -1; | 42 | return -1; |
42 | } | 43 | } |
43 | 44 | ||
@@ -66,6 +67,11 @@ int test__perf_evsel__tp_sched_test(void) | |||
66 | 67 | ||
67 | evsel = perf_evsel__newtp("sched", "sched_wakeup"); | 68 | evsel = perf_evsel__newtp("sched", "sched_wakeup"); |
68 | 69 | ||
70 | if (IS_ERR(evsel)) { | ||
71 | pr_debug("perf_evsel__newtp failed with %ld\n", PTR_ERR(evsel)); | ||
72 | return -1; | ||
73 | } | ||
74 | |||
69 | if (perf_evsel__test_field(evsel, "comm", 16, true)) | 75 | if (perf_evsel__test_field(evsel, "comm", 16, true)) |
70 | ret = -1; | 76 | ret = -1; |
71 | 77 | ||
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c index 666b67a4df9d..4495493c9431 100644 --- a/tools/perf/tests/mmap-basic.c +++ b/tools/perf/tests/mmap-basic.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "thread_map.h" | 3 | #include "thread_map.h" |
4 | #include "cpumap.h" | 4 | #include "cpumap.h" |
5 | #include "tests.h" | 5 | #include "tests.h" |
6 | #include <linux/err.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * This test will generate random numbers of calls to some getpid syscalls, | 9 | * This test will generate random numbers of calls to some getpid syscalls, |
@@ -65,7 +66,7 @@ int test__basic_mmap(void) | |||
65 | 66 | ||
66 | snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]); | 67 | snprintf(name, sizeof(name), "sys_enter_%s", syscall_names[i]); |
67 | evsels[i] = perf_evsel__newtp("syscalls", name); | 68 | evsels[i] = perf_evsel__newtp("syscalls", name); |
68 | if (evsels[i] == NULL) { | 69 | if (IS_ERR(evsels[i])) { |
69 | pr_debug("perf_evsel__new\n"); | 70 | pr_debug("perf_evsel__new\n"); |
70 | goto out_delete_evlist; | 71 | goto out_delete_evlist; |
71 | } | 72 | } |
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c index 495d8126b722..9e104a2e973d 100644 --- a/tools/perf/tests/openat-syscall-all-cpus.c +++ b/tools/perf/tests/openat-syscall-all-cpus.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <api/fs/fs.h> | 1 | #include <api/fs/fs.h> |
2 | #include <linux/err.h> | ||
2 | #include "evsel.h" | 3 | #include "evsel.h" |
3 | #include "tests.h" | 4 | #include "tests.h" |
4 | #include "thread_map.h" | 5 | #include "thread_map.h" |
@@ -31,7 +32,7 @@ int test__openat_syscall_event_on_all_cpus(void) | |||
31 | CPU_ZERO(&cpu_set); | 32 | CPU_ZERO(&cpu_set); |
32 | 33 | ||
33 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); | 34 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); |
34 | if (evsel == NULL) { | 35 | if (IS_ERR(evsel)) { |
35 | tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat"); | 36 | tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat"); |
36 | pr_err("%s\n", errbuf); | 37 | pr_err("%s\n", errbuf); |
37 | goto out_thread_map_delete; | 38 | goto out_thread_map_delete; |
diff --git a/tools/perf/tests/openat-syscall-tp-fields.c b/tools/perf/tests/openat-syscall-tp-fields.c index 01a19626c846..473d3869727e 100644 --- a/tools/perf/tests/openat-syscall-tp-fields.c +++ b/tools/perf/tests/openat-syscall-tp-fields.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/err.h> | ||
1 | #include "perf.h" | 2 | #include "perf.h" |
2 | #include "evlist.h" | 3 | #include "evlist.h" |
3 | #include "evsel.h" | 4 | #include "evsel.h" |
@@ -30,7 +31,7 @@ int test__syscall_openat_tp_fields(void) | |||
30 | } | 31 | } |
31 | 32 | ||
32 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); | 33 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); |
33 | if (evsel == NULL) { | 34 | if (IS_ERR(evsel)) { |
34 | pr_debug("%s: perf_evsel__newtp\n", __func__); | 35 | pr_debug("%s: perf_evsel__newtp\n", __func__); |
35 | goto out_delete_evlist; | 36 | goto out_delete_evlist; |
36 | } | 37 | } |
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c index 08ac9d94a050..7b1db8306098 100644 --- a/tools/perf/tests/openat-syscall.c +++ b/tools/perf/tests/openat-syscall.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <api/fs/tracing_path.h> | 1 | #include <api/fs/tracing_path.h> |
2 | #include <linux/err.h> | ||
2 | #include "thread_map.h" | 3 | #include "thread_map.h" |
3 | #include "evsel.h" | 4 | #include "evsel.h" |
4 | #include "debug.h" | 5 | #include "debug.h" |
@@ -19,7 +20,7 @@ int test__openat_syscall_event(void) | |||
19 | } | 20 | } |
20 | 21 | ||
21 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); | 22 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); |
22 | if (evsel == NULL) { | 23 | if (IS_ERR(evsel)) { |
23 | tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat"); | 24 | tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat"); |
24 | pr_err("%s\n", errbuf); | 25 | pr_err("%s\n", errbuf); |
25 | goto out_thread_map_delete; | 26 | goto out_thread_map_delete; |
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index d51a5200c8af..3cb2bf9bd4bd 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/bitops.h> | 25 | #include <linux/bitops.h> |
26 | #include <linux/hash.h> | 26 | #include <linux/hash.h> |
27 | #include <linux/log2.h> | 27 | #include <linux/log2.h> |
28 | #include <linux/err.h> | ||
28 | 29 | ||
29 | static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx); | 30 | static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx); |
30 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx); | 31 | static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx); |
@@ -265,7 +266,7 @@ int perf_evlist__add_newtp(struct perf_evlist *evlist, | |||
265 | { | 266 | { |
266 | struct perf_evsel *evsel = perf_evsel__newtp(sys, name); | 267 | struct perf_evsel *evsel = perf_evsel__newtp(sys, name); |
267 | 268 | ||
268 | if (evsel == NULL) | 269 | if (IS_ERR(evsel)) |
269 | return -1; | 270 | return -1; |
270 | 271 | ||
271 | evsel->handler = handler; | 272 | evsel->handler = handler; |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 771ade4d5966..6b5d1b509148 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <traceevent/event-parse.h> | 13 | #include <traceevent/event-parse.h> |
14 | #include <linux/hw_breakpoint.h> | 14 | #include <linux/hw_breakpoint.h> |
15 | #include <linux/perf_event.h> | 15 | #include <linux/perf_event.h> |
16 | #include <linux/err.h> | ||
16 | #include <sys/resource.h> | 17 | #include <sys/resource.h> |
17 | #include "asm/bug.h" | 18 | #include "asm/bug.h" |
18 | #include "callchain.h" | 19 | #include "callchain.h" |
@@ -225,11 +226,17 @@ struct perf_evsel *perf_evsel__new_idx(struct perf_event_attr *attr, int idx) | |||
225 | return evsel; | 226 | return evsel; |
226 | } | 227 | } |
227 | 228 | ||
229 | /* | ||
230 | * Returns pointer with encoded error via <linux/err.h> interface. | ||
231 | */ | ||
228 | struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx) | 232 | struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx) |
229 | { | 233 | { |
230 | struct perf_evsel *evsel = zalloc(perf_evsel__object.size); | 234 | struct perf_evsel *evsel = zalloc(perf_evsel__object.size); |
235 | int err = -ENOMEM; | ||
231 | 236 | ||
232 | if (evsel != NULL) { | 237 | if (evsel == NULL) { |
238 | goto out_err; | ||
239 | } else { | ||
233 | struct perf_event_attr attr = { | 240 | struct perf_event_attr attr = { |
234 | .type = PERF_TYPE_TRACEPOINT, | 241 | .type = PERF_TYPE_TRACEPOINT, |
235 | .sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | | 242 | .sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | |
@@ -240,8 +247,10 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int | |||
240 | goto out_free; | 247 | goto out_free; |
241 | 248 | ||
242 | evsel->tp_format = trace_event__tp_format(sys, name); | 249 | evsel->tp_format = trace_event__tp_format(sys, name); |
243 | if (evsel->tp_format == NULL) | 250 | if (IS_ERR(evsel->tp_format)) { |
251 | err = PTR_ERR(evsel->tp_format); | ||
244 | goto out_free; | 252 | goto out_free; |
253 | } | ||
245 | 254 | ||
246 | event_attr_init(&attr); | 255 | event_attr_init(&attr); |
247 | attr.config = evsel->tp_format->id; | 256 | attr.config = evsel->tp_format->id; |
@@ -254,7 +263,8 @@ struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int | |||
254 | out_free: | 263 | out_free: |
255 | zfree(&evsel->name); | 264 | zfree(&evsel->name); |
256 | free(evsel); | 265 | free(evsel); |
257 | return NULL; | 266 | out_err: |
267 | return ERR_PTR(err); | ||
258 | } | 268 | } |
259 | 269 | ||
260 | const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX] = { | 270 | const char *perf_evsel__hw_names[PERF_COUNT_HW_MAX] = { |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index f164a149da82..62ab307b7306 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -160,6 +160,9 @@ static inline struct perf_evsel *perf_evsel__new(struct perf_event_attr *attr) | |||
160 | 160 | ||
161 | struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx); | 161 | struct perf_evsel *perf_evsel__newtp_idx(const char *sys, const char *name, int idx); |
162 | 162 | ||
163 | /* | ||
164 | * Returns pointer with encoded error via <linux/err.h> interface. | ||
165 | */ | ||
163 | static inline struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name) | 166 | static inline struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name) |
164 | { | 167 | { |
165 | return perf_evsel__newtp_idx(sys, name, 0); | 168 | return perf_evsel__newtp_idx(sys, name, 0); |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 1b284b8ad243..c47831c47220 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #include <linux/hw_breakpoint.h> | 1 | #include <linux/hw_breakpoint.h> |
2 | #include <linux/err.h> | ||
2 | #include "util.h" | 3 | #include "util.h" |
3 | #include "../perf.h" | 4 | #include "../perf.h" |
4 | #include "evlist.h" | 5 | #include "evlist.h" |
@@ -393,11 +394,10 @@ static int add_tracepoint(struct list_head *list, int *idx, | |||
393 | struct perf_evsel *evsel; | 394 | struct perf_evsel *evsel; |
394 | 395 | ||
395 | evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++); | 396 | evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++); |
396 | if (!evsel) | 397 | if (IS_ERR(evsel)) |
397 | return -ENOMEM; | 398 | return PTR_ERR(evsel); |
398 | 399 | ||
399 | list_add_tail(&evsel->node, list); | 400 | list_add_tail(&evsel->node, list); |
400 | |||
401 | return 0; | 401 | return 0; |
402 | } | 402 | } |
403 | 403 | ||
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c index 2f4996ab313d..802bb868d446 100644 --- a/tools/perf/util/trace-event.c +++ b/tools/perf/util/trace-event.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <sys/stat.h> | 7 | #include <sys/stat.h> |
8 | #include <fcntl.h> | 8 | #include <fcntl.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/err.h> | ||
10 | #include <traceevent/event-parse.h> | 11 | #include <traceevent/event-parse.h> |
11 | #include <api/fs/tracing_path.h> | 12 | #include <api/fs/tracing_path.h> |
12 | #include "trace-event.h" | 13 | #include "trace-event.h" |
@@ -66,6 +67,9 @@ void trace_event__cleanup(struct trace_event *t) | |||
66 | pevent_free(t->pevent); | 67 | pevent_free(t->pevent); |
67 | } | 68 | } |
68 | 69 | ||
70 | /* | ||
71 | * Returns pointer with encoded error via <linux/err.h> interface. | ||
72 | */ | ||
69 | static struct event_format* | 73 | static struct event_format* |
70 | tp_format(const char *sys, const char *name) | 74 | tp_format(const char *sys, const char *name) |
71 | { | 75 | { |
@@ -74,12 +78,14 @@ tp_format(const char *sys, const char *name) | |||
74 | char path[PATH_MAX]; | 78 | char path[PATH_MAX]; |
75 | size_t size; | 79 | size_t size; |
76 | char *data; | 80 | char *data; |
81 | int err; | ||
77 | 82 | ||
78 | scnprintf(path, PATH_MAX, "%s/%s/%s/format", | 83 | scnprintf(path, PATH_MAX, "%s/%s/%s/format", |
79 | tracing_events_path, sys, name); | 84 | tracing_events_path, sys, name); |
80 | 85 | ||
81 | if (filename__read_str(path, &data, &size)) | 86 | err = filename__read_str(path, &data, &size); |
82 | return NULL; | 87 | if (err) |
88 | return ERR_PTR(err); | ||
83 | 89 | ||
84 | pevent_parse_format(pevent, &event, data, size, sys); | 90 | pevent_parse_format(pevent, &event, data, size, sys); |
85 | 91 | ||
@@ -87,11 +93,14 @@ tp_format(const char *sys, const char *name) | |||
87 | return event; | 93 | return event; |
88 | } | 94 | } |
89 | 95 | ||
96 | /* | ||
97 | * Returns pointer with encoded error via <linux/err.h> interface. | ||
98 | */ | ||
90 | struct event_format* | 99 | struct event_format* |
91 | trace_event__tp_format(const char *sys, const char *name) | 100 | trace_event__tp_format(const char *sys, const char *name) |
92 | { | 101 | { |
93 | if (!tevent_initialized && trace_event__init2()) | 102 | if (!tevent_initialized && trace_event__init2()) |
94 | return NULL; | 103 | return ERR_PTR(-ENOMEM); |
95 | 104 | ||
96 | return tp_format(sys, name); | 105 | return tp_format(sys, name); |
97 | } | 106 | } |