diff mbox series

KVM: x86: get rid of odd out jump label in pdptrs_changed

Message ID 1571968878-10437-1-git-send-email-linmiaohe@huawei.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86: get rid of odd out jump label in pdptrs_changed | expand

Commit Message

Miaohe Lin Oct. 25, 2019, 2:01 a.m. UTC
The odd out jump label is really not needed. Get rid of
it by check r >= 0.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 arch/x86/kvm/x86.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini Oct. 25, 2019, 9:43 a.m. UTC | #1
On 25/10/19 04:01, Miaohe Lin wrote:
> -	if (r < 0)
> -		goto out;
> -	changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs, sizeof(pdpte)) != 0;
> -out:
> +	if (r >= 0)
> +		changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs,
> +				 sizeof(pdpte)) != 0;
>  
>  	return changed;

Even better:

	if (r < 0)
		return true;

	return memcmp(...) != 0;

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ff395f812719..b6235872fd58 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -737,10 +737,9 @@  bool pdptrs_changed(struct kvm_vcpu *vcpu)
 	offset = (kvm_read_cr3(vcpu) & 0xffffffe0ul) & (PAGE_SIZE - 1);
 	r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
 				       PFERR_USER_MASK | PFERR_WRITE_MASK);
-	if (r < 0)
-		goto out;
-	changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs, sizeof(pdpte)) != 0;
-out:
+	if (r >= 0)
+		changed = memcmp(pdpte, vcpu->arch.walk_mmu->pdptrs,
+				 sizeof(pdpte)) != 0;
 
 	return changed;
 }