[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211027024212.64842-1-quic_qiancai@quicinc.com>
Date: Tue, 26 Oct 2021 22:42:12 -0400
From: Qian Cai <quic_qiancai@...cinc.com>
To: Marc Zyngier <maz@...nel.org>
CC: James Morse <james.morse@....com>,
Alexandru Elisei <alexandru.elisei@....com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<kvmarm@...ts.cs.columbia.edu>, <linux-kernel@...r.kernel.org>,
Qian Cai <quic_qiancai@...cinc.com>
Subject: [PATCH] KVM: arm64: Avoid shadowing a previous local
It is less-prone to have a different variable name from the one in a wider
scope. This is also flagged by GCC (W=2):
In file included from ./include/linux/kvm_host.h:39,
from arch/arm64/kvm/arm.c:12:
arch/arm64/kvm/arm.c: In function 'kvm_arch_vcpu_ioctl_run':
./arch/arm64/include/asm/kvm_host.h:638:26: warning: declaration of 'ret' shadows a previous local [-Wshadow]
638 | typeof(f(__VA_ARGS__)) ret; \
| ^~~
arch/arm64/kvm/arm.c:852:9: note: in expansion of macro 'kvm_call_hyp_ret'
852 | ret = kvm_call_hyp_ret(__kvm_vcpu_run, vcpu);
| ^~~~~~~~~~~~~~~~
arch/arm64/kvm/arm.c:773:6: note: shadowed declaration is here
773 | int ret;
| ^~~
Signed-off-by: Qian Cai <quic_qiancai@...cinc.com>
---
arch/arm64/include/asm/kvm_host.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 4be8486042a7..4693d84ccd95 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -635,16 +635,16 @@ void kvm_arm_resume_guest(struct kvm *kvm);
#define kvm_call_hyp_ret(f, ...) \
({ \
- typeof(f(__VA_ARGS__)) ret; \
+ typeof(f(__VA_ARGS__)) __ret; \
\
if (has_vhe()) { \
- ret = f(__VA_ARGS__); \
+ __ret = f(__VA_ARGS__); \
isb(); \
} else { \
- ret = kvm_call_hyp_nvhe(f, ##__VA_ARGS__); \
+ __ret = kvm_call_hyp_nvhe(f, ##__VA_ARGS__); \
} \
\
- ret; \
+ __ret; \
})
#else /* __KVM_NVHE_HYPERVISOR__ */
#define kvm_call_hyp(f, ...) f(__VA_ARGS__)
--
2.30.2
Powered by blists - more mailing lists