KVM: Unset kvm_arch_ops if arch module loading failed
authorAvi Kivity <avi@qumranet.com>
Thu, 1 Mar 2007 17:21:03 +0000 (19:21 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 18 Mar 2007 08:49:06 +0000 (10:49 +0200)
Otherwise, the core module thinks the arch module is loaded, and won't
let you reload it after you've fixed the bug.

Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm_main.c

index a163bca38973024bc8b0a4627c0dbb2c8a0c007a..dc7a8c78cbf9f31297e922d6b2c4a270ce75d21d 100644 (file)
@@ -2464,7 +2464,7 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
 
        r = kvm_arch_ops->hardware_setup();
        if (r < 0)
-           return r;
+               goto out;
 
        on_each_cpu(kvm_arch_ops->hardware_enable, NULL, 0, 1);
        r = register_cpu_notifier(&kvm_cpu_notifier);
@@ -2500,6 +2500,8 @@ out_free_2:
 out_free_1:
        on_each_cpu(kvm_arch_ops->hardware_disable, NULL, 0, 1);
        kvm_arch_ops->hardware_unsetup();
+out:
+       kvm_arch_ops = NULL;
        return r;
 }