Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <linmq006@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <song@kernel.org>
Link: http://lore.kernel.org/lkml/20211211053856.19827-1-linmq006@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Miaoqian Lin and committed by
Arnaldo Carvalho de Melo
9937e8da 6665b8e4

+1 -1
+1 -1
tools/perf/util/python.c
··· 461 461 struct tep_event *tp_format; 462 462 463 463 tp_format = trace_event__tp_format_id(evsel->core.attr.config); 464 - if (!tp_format) 464 + if (IS_ERR_OR_NULL(tp_format)) 465 465 return NULL; 466 466 467 467 evsel->tp_format = tp_format;