[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fW=Lz0NDS2=D2cKOAjVT2qP6Lw3QJsCqhac4w-X0XjH_A@mail.gmail.com>
Date: Mon, 18 Aug 2025 15:17:09 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Kan Liang <kan.liang@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, linux-perf-users@...r.kernel.org,
David Binderman <dcb314@...mail.com>
Subject: Re: [PATCH] perf tools: Remove a pointless check
On Fri, Aug 8, 2025 at 3:26 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> 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@...mail.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> ---
> tools/perf/util/tool_pmu.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/tools/perf/util/tool_pmu.c b/tools/perf/util/tool_pmu.c
> index d99e699e646dd651..f075098488baddd9 100644
> --- a/tools/perf/util/tool_pmu.c
> +++ b/tools/perf/util/tool_pmu.c
> @@ -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);
>
> --
> 2.51.0.rc0.155.g4a0f42376b-goog
>
Powered by blists - more mailing lists