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:
Lioncash 2018-02-12 15:37:43 -05:00
parent 51b49a5b97
commit 92c076c042
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -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);
if (error) {
goto out;
goto 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;
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)