aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/trace-event-scripting.c
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2024-11-18 22:53:43 +0000
committerArnaldo Carvalho de Melo <[email protected]>2024-12-09 20:52:42 +0000
commitc46d634a03a309df461294a001cdf71b77d43b57 (patch)
tree5a3fed280afb1bc8c2fe223ab627f78714b1b3a7 /tools/perf/util/trace-event-scripting.c
parentperf trace-event: Always build trace-event-info.c (diff)
downloadkernel-c46d634a03a309df461294a001cdf71b77d43b57.tar.gz
kernel-c46d634a03a309df461294a001cdf71b77d43b57.zip
perf evsel: Add/use accessor for tp_format
Add an accessor function for tp_format. Rather than search+replace uses try to use a variable and reuse it. Add additional NULL checks when accessing/using the value. Make sure the PTR_ERR is nulled out on error path in evsel__newtp_idx. Reviewed-by: Namhyung Kim <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Ben Gainey <[email protected]> Cc: Colin Ian King <[email protected]> Cc: Dominique Martinet <[email protected]> Cc: Ilkka Koskinen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Paran Lee <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steinar H. Gunderson <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Thomas Falcon <[email protected]> Cc: Weilin Wang <[email protected]> Cc: Yang Jihong <[email protected]> Cc: Yang Li <[email protected]> Cc: Ze Gao <[email protected]> Cc: Zixian Cai <[email protected]> Cc: zhaimingbing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
-rw-r--r--tools/perf/util/trace-event-scripting.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 5596fcda2c10..edfde7056c99 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -28,12 +28,14 @@ void scripting_context__update(struct scripting_context *c,
struct addr_location *al,
struct addr_location *addr_al)
{
- c->event_data = sample->raw_data;
- c->pevent = NULL;
#ifdef HAVE_LIBTRACEEVENT
- if (evsel->tp_format)
- c->pevent = evsel->tp_format->tep;
+ const struct tep_event *tp_format = evsel__tp_format(evsel);
+
+ c->pevent = tp_format ? tp_format->tep : NULL;
+#else
+ c->pevent = NULL;
#endif
+ c->event_data = sample->raw_data;
c->event = event;
c->sample = sample;
c->evsel = evsel;