If x86_cpu_realize() set any errors, print an error message and return NULL.
Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- 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