QOM CPUState refactorings

* Clean up X86CPU error handling
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJSAUceAAoJEPou0S0+fgE/vRYQAIDWr+QQdCCguCXT/SkhwisC
 Zg5offOCDo70fJnkBqvvZcb934hVgsDgdZUacl8niI7J8bdI01ZQM+YOWHfRLQQN
 m5l3H8eMyr0k4hecMClUD9VXp6tchry31bxh2K05jrsIxnCpx8XiYzM4Dj0Nde/t
 yZcw1LmjspdswNDTbMc1zyZ7j5l8o6bZjswBA6ssJuY9+ZXzikWtNcrgVJ0dLwQC
 BqdMEHHgZ+6p3NPFSHn6AB7dMJSQqj6NeXDHsEFE0/bNGvij2Pg3jyzB79iZ8/8x
 s3xxxIz2oYHfca+hPjlqXTjbTHewIW9FGdgG0OUZy4VhFfMdkqw1QhcMDOEyo9Ny
 66nH4T9/RJJelVPF9G+hNfSNIH0SVWkbE05apHEA+9NjsXwS7K9MeTukMy1r7kY0
 dk8T94eAnxncNmzb2T0ZvAx2u5Sg0qiA6hevFtwRhCG7L1IYeo61Yy8fWz928le1
 iZCrPrN6+tBuRkOB/SgNJLP5Rto6XnL9hKagZUeleXvJzh1x9lspwHFKk8J9+9I9
 tsga0igeegKpEWs6cTWSOusKMTWBuhpPnFPoZCHbtq8CLvpKvSd/4bTHU0xtSiwW
 6aNzghncG3RQqTi9Tj6DTF1Aq2Ak9fGZWt2cEWr+oUnpkkDNPwwrQv7rN8WgKbeD
 iFUv74PRoyuUJg7a0kXJ
 =6AAH
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into 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
This commit is contained in:
Anthony Liguori 2013-08-07 12:43:34 -05:00
commit 6c0f48f5b6
2 changed files with 11 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;
}