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

perf bench: The do_run_multi_threaded() function must use IS_ERR(perf_session__new())

In case of error, the function perf_session__new() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR()

Committer notes:

This wasn't compiling due to an extraneous '{' not matched by a '}', fix
it.

Fixes: 13edc237200c ("perf bench: Add a multi-threaded synthesize benchmark")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.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>
Link: http://lore.kernel.org/lkml/20200902140526.26916-1-yuehaibing@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

YueHaibing and committed by
Arnaldo Carvalho de Melo
e4d71f79 ee6a9614

+2 -2
+2 -2
tools/perf/bench/synthesize.c
··· 162 162 init_stats(&event_stats); 163 163 for (i = 0; i < multi_iterations; i++) { 164 164 session = perf_session__new(NULL, false, NULL); 165 - if (!session) 166 - return -ENOMEM; 165 + if (IS_ERR(session)) 166 + return PTR_ERR(session); 167 167 168 168 atomic_set(&event_count, 0); 169 169 gettimeofday(&start, NULL);