mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 10:35:12 +00:00
target-i386: Simplify error handling on cpu_x86_init_user()
Isolate error handling path from the "if (error)" checks. Backports commit 18b0e4e77142ace948497a053bd5b56c1b849592 from qemu
This commit is contained in:
parent
51b49a5b97
commit
92c076c042
|
@ -1812,20 +1812,18 @@ CPUX86State *cpu_x86_init_user(struct uc_struct *uc, const char *cpu_model)
|
||||||
|
|
||||||
cpu = cpu_x86_create(uc, cpu_model, &error);
|
cpu = cpu_x86_create(uc, cpu_model, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
goto out;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_property_set_bool(uc, OBJECT(cpu), true, "realized", &error);
|
object_property_set_bool(uc, OBJECT(cpu), true, "realized", &error);
|
||||||
|
|
||||||
out:
|
|
||||||
if (error) {
|
|
||||||
error_free(error);
|
|
||||||
if (cpu != NULL) {
|
|
||||||
object_unref(uc, OBJECT(cpu));
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return &cpu->env;
|
return &cpu->env;
|
||||||
|
|
||||||
|
error:
|
||||||
|
error_free(error);
|
||||||
|
if (cpu != NULL) {
|
||||||
|
object_unref(uc, OBJECT(cpu));
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void x86_cpu_cpudef_class_init(struct uc_struct *uc, ObjectClass *oc, void *data)
|
static void x86_cpu_cpudef_class_init(struct uc_struct *uc, ObjectClass *oc, void *data)
|
||||||
|
|
Loading…
Reference in a new issue