diff options
author | Igor Mammedov <imammedo@redhat.com> | 2013-04-05 16:36:53 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-04-16 01:19:46 +0200 |
commit | 4dc1f449ab22bb79ea3894bd90b154c30d73573e (patch) | |
tree | 1cd02fa4946bf733498d25802d2cc597758d9b60 /target-i386/cpu.c | |
parent | 72cc5137759ce1393c9eeac81b677947d618351d (diff) |
target-i386: Consolidate error propagation in x86_cpu_realizefn()
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386/cpu.c')
-rw-r--r-- | target-i386/cpu.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0a4e5aea1c..9d45f09074 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2099,9 +2099,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) X86CPU *cpu = X86_CPU(dev); X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; -#ifndef CONFIG_USER_ONLY Error *local_err = NULL; -#endif if (env->cpuid_7_0_ebx_features && env->cpuid_level < 7) { env->cpuid_level = 7; @@ -2131,8 +2129,9 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) } else { if (check_cpuid && kvm_check_features_against_host(cpu) && enforce_cpuid) { - error_setg(errp, "Host's CPU doesn't support requested features"); - return; + error_setg(&local_err, + "Host's CPU doesn't support requested features"); + goto out; } #ifdef CONFIG_KVM filter_features_for_kvm(cpu); @@ -2145,8 +2144,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) if (cpu->env.cpuid_features & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_init(cpu, &local_err); if (local_err != NULL) { - error_propagate(errp, local_err); - return; + goto out; } } #endif @@ -2155,7 +2153,12 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp) qemu_init_vcpu(&cpu->env); cpu_reset(CPU(cpu)); - xcc->parent_realize(dev, errp); + xcc->parent_realize(dev, &local_err); +out: + if (local_err != NULL) { + error_propagate(errp, local_err); + return; + } } /* Enables contiguous-apic-ID mode, for compatibility */ |