]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf tools: Remove a pointless check
authorNamhyung Kim <namhyung@kernel.org>
Fri, 8 Aug 2025 22:26:50 +0000 (15:26 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 19 Sep 2025 15:14:30 +0000 (12:14 -0300)
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>
tools/perf/util/tool_pmu.c

index d99e699e646dd651a36c5f2def821d79d42c4af8..f075098488baddd9b5160b7868d9abe6c13c7038 100644 (file)
@@ -239,9 +239,6 @@ int evsel__tool_pmu_open(struct evsel *evsel,
        nthreads = perf_thread_map__nr(threads);
        for (idx = start_cpu_map_idx; idx < end_cpu_map_idx; idx++) {
                for (thread = 0; thread < nthreads; thread++) {
-                       if (thread >= nthreads)
-                               break;
-
                        if (!evsel->cgrp && !evsel->core.system_wide)
                                pid = perf_thread_map__pid(threads, thread);