Skip to contentSkip to conversation

KVM/X86: Remove unneeded variable

PATCH Superseded Quanfa Fu 2 participants 2 messages Dec 19, 2021 – Dec 20, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Quanfa Fu

author
#0 lore raw

PATCH 1/1 KVM/X86: Remove unneeded variable

Remove unneeded variable used to store return value.

No functional change intended.

---
 arch/x86/kvm/mmu/mmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/mmu/mmu.c +1 -4
index e2e1d012df22..7603db81b902 100644
@@ -2553,16 +2553,13 @@ int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn)
 static int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva)
 {
 	gpa_t gpa;
-	int r;
 
 	if (vcpu->arch.mmu->direct_map)
 		return 0;
 
 	gpa = kvm_mmu_gva_to_gpa_read(vcpu, gva, NULL);
 
-	r = kvm_mmu_unprotect_page(vcpu->kvm, gpa >> PAGE_SHIFT);
-
-	return r;
+	return kvm_mmu_unprotect_page(vcpu->kvm, gpa >> PAGE_SHIFT);
 }
 
 static void kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Quanfa Fu

Remove unneeded variable used to store return value.

No functional change intended.

---
 arch/x86/kvm/mmu/mmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/mmu/mmu.c +0 -1
index e2e1d012df22..7603db81b902 100644
@@ -2553,16 +2553,13 @@ int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn)
 static int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva)
 {
 	gpa_t gpa;
-	int r;

arch/x86/kvm/mmu/mmu.c int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn) · line 2562

Quoted 10 lines
arch/x86/kvm/mmu/mmu.c +1 -3
 
 	if (vcpu->arch.mmu->direct_map)
 		return 0;
 
 	gpa = kvm_mmu_gva_to_gpa_read(vcpu, gva, NULL);
 
-	r = kvm_mmu_unprotect_page(vcpu->kvm, gpa >> PAGE_SHIFT);
-
-	return r;
+	return kvm_mmu_unprotect_page(vcpu->kvm, gpa >> PAGE_SHIFT);

While on it, you could've switched to using gpa_to_gfn() here.

arch/x86/kvm/mmu/mmu.c int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn) · line 2565

Quoted 3 lines
arch/x86/kvm/mmu/mmu.c +0 -0
 }
 
 static void kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
Signature · 1 line
Vitaly