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

perf tools: Remove a pointless check

Static analyser cppcheck says:

linux-6.16/tools/perf/util/tool_pmu.c:242:15: warning:
Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]

Source code is:

for (thread = 0; thread < nthreads; thread++) {
if (thread >= nthreads)
break;

Reported-by: David Binderman <dcb314@hotmail.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
98dbed7a 817af72c

-3
-3
tools/perf/util/tool_pmu.c
··· 239 239 nthreads = perf_thread_map__nr(threads); 240 240 for (idx = start_cpu_map_idx; idx < end_cpu_map_idx; idx++) { 241 241 for (thread = 0; thread < nthreads; thread++) { 242 - if (thread >= nthreads) 243 - break; 244 - 245 242 if (!evsel->cgrp && !evsel->core.system_wide) 246 243 pid = perf_thread_map__pid(threads, thread); 247 244