Hi Nathan Chancellor : Thank you very much for pointing out the problem, I will integrate this patch in the next version. Thanks! Xianglai.
Clang warns (or errors with CONFIG_WERROR=y): arch/loongarch/kvm/intc/eiointc.c:512:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] 512 | default: | ^~~~~~~ arch/loongarch/kvm/intc/eiointc.c:716:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] 716 | default: | ^~~~~~~ Set ret to -EINVAL in the default case to resolve the warning, as len was not a valid value for the functions to handle. Fixes: f810ef038c66 ("LoongArch: KVM: Add EIOINTC read and write functions") Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx> --- arch/loongarch/kvm/intc/eiointc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c index 414e4ffd69173dc248ba0042bed3bebdc11700e3..e5d23f0da055c97c0e4ba6705f6b71d89846f42a 100644 --- a/arch/loongarch/kvm/intc/eiointc.c +++ b/arch/loongarch/kvm/intc/eiointc.c @@ -512,6 +512,7 @@ static int kvm_eiointc_write(struct kvm_vcpu *vcpu, default: WARN_ONCE(1, "%s: Abnormal address access:addr 0x%llx,size %d\n", __func__, addr, len); + ret = -EINVAL; } loongarch_ext_irq_unlock(eiointc, flags); return ret; @@ -716,6 +717,7 @@ static int kvm_eiointc_read(struct kvm_vcpu *vcpu, default: WARN_ONCE(1, "%s: Abnormal address access:addr 0x%llx,size %d\n", __func__, addr, len); + ret = -EINVAL; } loongarch_ext_irq_unlock(eiointc, flags); return ret; --- base-commit: 357da696640e1db8fc8829a4dd1bb2d0402169b5 change-id: 20240916-loongarch-kvm-eiointc-fix-sometimes-uninitialized-e17b039d2813 Best regards,