Re: [PATCH] ACPI: RISC-V: Fix false warning in cppc_read_ffh() for same-CPU reads

From: Nathan Chancellor

Date: Tue Dec 01 2026 - 15:58:22 EST


On Mon, Nov 30, 2026 at 06:18:16PM -0700, Paul Walmsley wrote:
> On Tue, 9 Jun 2026, wang.yechao255@xxxxxxxxxx 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@xxxxxxxxxx>
>
> 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