From: Vincent Donnefort <vdonnefort@google.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: avoid unused-variable warning
Date: Fri, 13 Mar 2026 11:07:35 +0000 [thread overview]
Message-ID: <abPv9_8F38yEiAQ9@google.com> (raw)
In-Reply-To: <20260313094925.3749287-1-arnd@kernel.org>
On Fri, Mar 13, 2026 at 10:49:16AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The 'cpu' variable is only used inside of an #ifdef block and causes
> a warning if there is no user:
>
> arch/arm64/kvm/hyp_trace.c: In function 'kvm_hyp_trace_init':
> arch/arm64/kvm/hyp_trace.c:422:13: error: unused variable 'cpu' [-Werror=unused-variable]
> 422 | int cpu;
> | ^~~
>
> Change the #ifdef to an equivalent IS_ENABLED() check to avoid
> the warning.
>
> Fixes: b22888917fa4 ("KVM: arm64: Sync boot clock with the nVHE/pKVM hyp")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/arm64/kvm/hyp_trace.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp_trace.c b/arch/arm64/kvm/hyp_trace.c
> index c1e28f6581ab..8b7f2bf2fba8 100644
> --- a/arch/arm64/kvm/hyp_trace.c
> +++ b/arch/arm64/kvm/hyp_trace.c
> @@ -424,17 +424,16 @@ int __init kvm_hyp_trace_init(void)
> if (is_kernel_in_hyp_mode())
> return 0;
>
> -#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
> for_each_possible_cpu(cpu) {
> const struct arch_timer_erratum_workaround *wa =
> per_cpu(timer_unstable_counter_workaround, cpu);
>
> - if (wa && wa->read_cntvct_el0) {
> + if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND) &&
> + wa && wa->read_cntvct_el0) {
> pr_warn("hyp trace can't handle CNTVCT workaround '%s'\n", wa->desc);
> return -EOPNOTSUPP;
> }
> }
> -#endif
>
> hyp_trace_init_events();
Reviewed-by: Vincent Donnefort <vdonnefort@google.com>
>
> --
> 2.39.5
>
next prev parent reply other threads:[~2026-03-13 11:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 9:49 [PATCH] KVM: arm64: avoid unused-variable warning Arnd Bergmann
2026-03-13 11:07 ` Vincent Donnefort [this message]
2026-03-17 9:17 ` Marc Zyngier
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=abPv9_8F38yEiAQ9@google.com \
--to=vdonnefort@google.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@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