KVM: x86: drop BUG_ON(vcpu->kvm)
authorDavid Hildenbrand <david@redhat.com>
Thu, 24 Aug 2017 18:51:25 +0000 (20:51 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 12 Oct 2017 12:01:51 +0000 (14:01 +0200)
And also get rid of that superfluous local variable "kvm".

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kvm/x86.c

index 03869eb7fcd67b64e54dcb67acd559a70fd61139..69be798b40af33601ed35ecdd12671a164cf081e 100644 (file)
@@ -7974,16 +7974,12 @@ EXPORT_SYMBOL_GPL(kvm_no_apic_vcpu);
 int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
 {
        struct page *page;
-       struct kvm *kvm;
        int r;
 
-       BUG_ON(vcpu->kvm == NULL);
-       kvm = vcpu->kvm;
-
        vcpu->arch.apicv_active = kvm_x86_ops->get_enable_apicv(vcpu);
        vcpu->arch.pv.pv_unhalted = false;
        vcpu->arch.emulate_ctxt.ops = &emulate_ops;
-       if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_reset_bsp(vcpu))
+       if (!irqchip_in_kernel(vcpu->kvm) || kvm_vcpu_is_reset_bsp(vcpu))
                vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
        else
                vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED;
@@ -8001,7 +7997,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
        if (r < 0)
                goto fail_free_pio_data;
 
-       if (irqchip_in_kernel(kvm)) {
+       if (irqchip_in_kernel(vcpu->kvm)) {
                r = kvm_create_lapic(vcpu);
                if (r < 0)
                        goto fail_mmu_destroy;