qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 19/27] cpu_x86_init: check for x86_cpu_realize() err


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 19/27] cpu_x86_init: check for x86_cpu_realize() errors
Date: Wed, 24 Oct 2012 15:49:53 -0200

If x86_cpu_realize() set any errors, print an error message and return
NULL.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 target-i386/helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/target-i386/helper.c b/target-i386/helper.c
index c5d42c5..1e5f61f 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -19,6 +19,7 @@
 
 #include "cpu.h"
 #include "kvm.h"
+#include "qemu-error.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu.h"
 #include "monitor.h"
@@ -1243,6 +1244,7 @@ X86CPU *cpu_x86_init(const char *cpu_model)
 {
     X86CPU *cpu;
     CPUX86State *env;
+    Error *err = NULL;
 
     cpu = X86_CPU(object_new(TYPE_X86_CPU));
     env = &cpu->env;
@@ -1253,7 +1255,11 @@ X86CPU *cpu_x86_init(const char *cpu_model)
         return NULL;
     }
 
-    x86_cpu_realize(OBJECT(cpu), NULL);
+    x86_cpu_realize(OBJECT(cpu), &err);
+    if (err) {
+        error_report("cpu_x86_init: %s\n", error_get_pretty(err));
+        return NULL;
+    }
 
     return cpu;
 }
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]