[PATCH] KVM: arm64: fix returnvar.cocci warnings

kernel test robot posted 1 patch 4 years, 2 months ago
arch/arm64/kvm/sdei.c |    3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] KVM: arm64: fix returnvar.cocci warnings
Posted by kernel test robot 4 years, 2 months ago
From: kernel test robot <lkp@intel.com>

arch/arm64/kvm/sdei.c:346:15-18: Unneeded variable: "ret". Return "SDEI_SUCCESS" on line 352


 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

CC: Gavin Shan <gshan@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

url:    https://github.com/intel-lab-lkp/linux/commits/Gavin-Shan/Support-SDEI-Virtualization/20220403-234350
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git be2d3ecedd9911fbfd7e55cc9ceac5f8b79ae4cf
:::::: branch date: 19 hours ago
:::::: commit date: 19 hours ago

 arch/arm64/kvm/sdei.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/arch/arm64/kvm/sdei.c
+++ b/arch/arm64/kvm/sdei.c
@@ -343,13 +343,12 @@ out:
 static unsigned long hypercall_mask(struct kvm_vcpu *vcpu, bool mask)
 {
 	struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
-	unsigned long ret = SDEI_SUCCESS;
 
 	spin_lock(&vsdei->lock);
 	vsdei->masked = mask ? 1 : 0;
 	spin_unlock(&vsdei->lock);
 
-	return ret;
+	return SDEI_SUCCESS;
 }
 
 int kvm_sdei_call(struct kvm_vcpu *vcpu)
Re: [PATCH] KVM: arm64: fix returnvar.cocci warnings
Posted by Gavin Shan 4 years, 2 months ago
On 4/4/22 6:26 PM, kernel test robot wrote:
> From: kernel test robot <lkp@intel.com>
> 
> arch/arm64/kvm/sdei.c:346:15-18: Unneeded variable: "ret". Return "SDEI_SUCCESS" on line 352
> 
> 
>   Remove unneeded variable used to store return value.
> 
> Generated by: scripts/coccinelle/misc/returnvar.cocci
> 
> CC: Gavin Shan <gshan@redhat.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> ---
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Gavin-Shan/Support-SDEI-Virtualization/20220403-234350
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git be2d3ecedd9911fbfd7e55cc9ceac5f8b79ae4cf
> :::::: branch date: 19 hours ago
> :::::: commit date: 19 hours ago
> 
>   arch/arm64/kvm/sdei.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> --- a/arch/arm64/kvm/sdei.c
> +++ b/arch/arm64/kvm/sdei.c
> @@ -343,13 +343,12 @@ out:
>   static unsigned long hypercall_mask(struct kvm_vcpu *vcpu, bool mask)
>   {
>   	struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei;
> -	unsigned long ret = SDEI_SUCCESS;
>   
>   	spin_lock(&vsdei->lock);
>   	vsdei->masked = mask ? 1 : 0;
>   	spin_unlock(&vsdei->lock);
>   
> -	return ret;
> +	return SDEI_SUCCESS;
>   }
>   
>   int kvm_sdei_call(struct kvm_vcpu *vcpu)
> 

Thanks for reporting the warning. I will fold the changes in next respin
if needed.

Thanks,
Gavin