Hi, Nathan, Thank you for your patch, but I think it is better to initialize it at declaration, and I will squash the change to the original patch since it hasn't been upstream. On Wed, Nov 13, 2024 at 1:02 AM Nathan Chancellor <nathan@xxxxxxxxxx> wrote: > > Clang warns (or errors with CONFIG_WERROR=y): > > arch/loongarch/kvm/intc/eiointc.c:323:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] > 323 | default: > | ^~~~~~~ > arch/loongarch/kvm/intc/eiointc.c:697:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] > 697 | 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: e24e9e0c1da4 ("LoongArch: KVM: Add EIOINTC read and write functions") > Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx> > --- > It appears that my previous version of this change did not get > incorporated in the new revision. I did not mark this as a v2 since it > has been some time. > > https://lore.kernel.org/r/20240916-loongarch-kvm-eiointc-fix-sometimes-uninitialized-v1-1-85142dcb2274@xxxxxxxxxx I'm very sorry that I have ignored this and didn't signal Xianglai. Huacai > --- > 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 0084839f41506eb3b99c2c38f9721f3c0101e384..6af3ecbe29caaaef1582b1fbb941c01638e721cf 100644 > --- a/arch/loongarch/kvm/intc/eiointc.c > +++ b/arch/loongarch/kvm/intc/eiointc.c > @@ -323,6 +323,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; > } > spin_unlock_irqrestore(&eiointc->lock, flags); > > @@ -697,6 +698,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; > } > spin_unlock_irqrestore(&eiointc->lock, flags); > > > --- > base-commit: f7cc7a98fb7124abc269ebf162fcb3a8893b660a > change-id: 20241112-loongarch-kvm-eiointc-fix-sometimes-uninitialized-1d9f543db2d2 > > Best regards, > -- > Nathan Chancellor <nathan@xxxxxxxxxx> >