The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Paul Walmsley <pjw@kernel.org>
Cc: wang.yechao255@zte.com.cn, linux-acpi@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	zhanjie9@hisilicon.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	rafael@kernel.org, viresh.kumar@linaro.org,
	zhenglifeng1@huawei.com, pierre.gondois@arm.com,
	palmer@dabbelt.com, lenb@kernel.org
Subject: Re: [PATCH] ACPI: RISC-V: Fix false warning in cppc_read_ffh() for same-CPU reads
Date: Tue, 1 Dec 2026 13:58:09 -0700	[thread overview]
Message-ID: <20261201205809.GA1860806@ax162> (raw)
In-Reply-To: <b73841de-e818-a783-ac03-ed80feaf0903@kernel.org>

On Mon, Nov 30, 2026 at 06:18:16PM -0700, Paul Walmsley wrote:
> On Tue, 9 Jun 2026, wang.yechao255@zte.com.cn wrote:
> 
> > Commit 997c021abc6e ("cpufreq: CPPC: Update FIE arch_freq_scale in
> > ticks for non-PCC regs") changed the CPPC Frequency Invariance Engine
> > to read AMU counters directly from the scheduler tick for non-PCC
> > register spaces (like FFH), instead of deferring to a kthread. This
> > means cppc_read_ffh() is now called with IRQs disabled from the tick
> > handler, triggering the warning.
> > 
> > This is the same fix as commit df6e4ab654dc ("arm64: topology: Fix
> > false warning in counters_read_on_cpu() for same-CPU reads").
> > 
> > Fixes: 997c021abc6e ("cpufreq: CPPC: Update FIE arch_freq_scale in ticks for non-PCC regs")
> > Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
> 
> Thanks, queued for v7.4-rc.

This patch breaks the -Werror clang build in -next with:

  drivers/acpi/riscv/cppc.c:112:8: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
    112 |                         if (WARN_ON_ONCE(cpu != smp_processor_id()))
        |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  include/asm-generic/bug.h:119:33: note: expanded from macro 'WARN_ON_ONCE'
    119 | #define WARN_ON_ONCE(condition) ({                                      \
        |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    120 |         int __ret_warn_on = !!(condition);                              \
        |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    121 |         if (unlikely(__ret_warn_on))                                    \
        |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    122 |                 __WARN_FLAGS(#condition,                                \
        |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    123 |                              BUGFLAG_ONCE |                             \
        |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    124 |                              BUGFLAG_TAINT(TAINT_WARN));                \
        |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    125 |         unlikely(__ret_warn_on);                                        \
        |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    126 | })
        | ~~
  drivers/acpi/riscv/cppc.c:120:7: note: uninitialized use occurs here
    120 |                 if (ret)
        |                     ^~~
  drivers/acpi/riscv/cppc.c:112:4: note: remove the 'if' if its condition is always true
    112 |                         if (WARN_ON_ONCE(cpu != smp_processor_id()))
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    113 |                                 return -EPERM;
  drivers/acpi/riscv/cppc.c:100:9: note: initialize the variable 'ret' to silence this warning
    100 |         int ret;
        |                ^
        |                 = 0
  1 error generated.

Seems legitimate?

-- 
Cheers,
Nathan

      reply	other threads:[~2026-12-01 20:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09 11:28 [PATCH] ACPI: RISC-V: Fix false warning in cppc_read_ffh() for same-CPU reads wang.yechao255
2026-06-25 12:10 ` Jie Zhan
2026-07-01  3:14 ` Sunil V L
2026-12-01  1:18 ` Paul Walmsley
2026-12-01 20:58   ` Nathan Chancellor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201205809.GA1860806@ax162 \
    --to=nathan@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pierre.gondois@arm.com \
    --cc=pjw@kernel.org \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=wang.yechao255@zte.com.cn \
    --cc=zhanjie9@hisilicon.com \
    --cc=zhenglifeng1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox