]> git.proxmox.com Git - mirror_qemu.git/blobdiff - kvm-all.c
kvm_init didn't set return value after create vm failed
[mirror_qemu.git] / kvm-all.c
index c09ddf7ac5067a6d49d38b85c6b5d980c5b77996..4c466d6aba4cacfe927b5a442e55cc111bdb106e 100644 (file)
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -740,6 +740,7 @@ int kvm_init(void)
         fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
                         "your host kernel command line\n");
 #endif
+        ret = s->vmfd;
         goto err;
     }
 
@@ -798,7 +799,7 @@ int kvm_init(void)
 
 err:
     if (s) {
-        if (s->vmfd != -1) {
+        if (s->vmfd >= 0) {
             close(s->vmfd);
         }
         if (s->fd != -1) {