Skip to content

Commit 9937e8d

Browse files
Yuuoniyacmel
authored andcommitted
perf python: Fix NULL vs IS_ERR_OR_NULL() checking
The function trace_event__tp_format_id may return ERR_PTR(-ENOMEM). Use IS_ERR_OR_NULL to check tp_format. Signed-off-by: Miaoqian Lin <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Song Liu <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 6665b8e commit 9937e8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/util/python.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name)
461461
struct tep_event *tp_format;
462462

463463
tp_format = trace_event__tp_format_id(evsel->core.attr.config);
464-
if (!tp_format)
464+
if (IS_ERR_OR_NULL(tp_format))
465465
return NULL;
466466

467467
evsel->tp_format = tp_format;

0 commit comments

Comments
 (0)