From: Gautam Menghani Date: Mon, 4 Aug 2025 11:06:01 +0000 (+0530) Subject: perf auxtrace: Avoid redundant NULL check in auxtrace_mmap_params__set_idx() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=54a7685fd2d687dc4a7015d7bc32614d65d0d05a;p=users%2Fhch%2Fmisc.git perf auxtrace: Avoid redundant NULL check in auxtrace_mmap_params__set_idx() Since commit eead8a011477 ("libperf threadmap: Don't segv for index 0 for the NULL 'struct perf_thread_map' pointer"), perf_thread_map__pid() can check for a NULL map and return -1 if idx is 0. Cleanup auxtrace_mmap_params__set_idx() and remove the redundant NULL check. No functional change intended. Reviewed-by: Aditya Bodkhe Reviewed-by: Adrian Hunter Reviewed-by: Amit Machhiwal Signed-off-by: Gautam Menghani Cc: Alexander Shishkin Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c index ebd32f1b8f12..5e437133c753 100644 --- a/tools/perf/util/auxtrace.c +++ b/tools/perf/util/auxtrace.c @@ -185,10 +185,7 @@ void auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp, if (per_cpu) { mp->cpu = perf_cpu_map__cpu(evlist->core.all_cpus, idx); - if (evlist->core.threads) - mp->tid = perf_thread_map__pid(evlist->core.threads, 0); - else - mp->tid = -1; + mp->tid = perf_thread_map__pid(evlist->core.threads, 0); } else { mp->cpu.cpu = -1; mp->tid = perf_thread_map__pid(evlist->core.threads, idx);