Skip to content

Commit

Permalink
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into…
Browse files Browse the repository at this point in the history
… staging

QOM CPUState refactorings

* Clean up X86CPU error handling

# gpg: Signature made Tue 06 Aug 2013 01:57:34 PM CDT using RSA key ID 3E7E013F
# gpg: Can't check signature: public key not found

# By Andreas Färber
# Via Andreas Färber
* afaerber/tags/qom-cpu-for-anthony:
  target-i386: Fix X86CPU error handling
  • Loading branch information
Anthony Liguori committed Aug 7, 2013
2 parents cafffa5 + cd7b87f commit 6c0f48f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 6 additions & 7 deletions hw/i386/pc.c
Expand Up @@ -912,20 +912,19 @@ static X86CPU *pc_new_cpu(const char *cpu_model, int64_t apic_id,
X86CPU *cpu;
Error *local_err = NULL;

cpu = cpu_x86_create(cpu_model, icc_bridge, errp);
if (!cpu) {
return cpu;
cpu = cpu_x86_create(cpu_model, icc_bridge, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
return NULL;
}

object_property_set_int(OBJECT(cpu), apic_id, "apic-id", &local_err);
object_property_set_bool(OBJECT(cpu), true, "realized", &local_err);

if (local_err) {
if (cpu != NULL) {
object_unref(OBJECT(cpu));
cpu = NULL;
}
error_propagate(errp, local_err);
object_unref(OBJECT(cpu));
cpu = NULL;
}
return cpu;
}
Expand Down
6 changes: 5 additions & 1 deletion target-i386/cpu.c
Expand Up @@ -1824,7 +1824,11 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
}

out:
error_propagate(errp, error);
if (error != NULL) {
error_propagate(errp, error);
object_unref(OBJECT(cpu));
cpu = NULL;
}
g_strfreev(model_pieces);
return cpu;
}
Expand Down

0 comments on commit 6c0f48f

Please sign in to comment.