Fix cpu_model by name, make any and or1200 works both OK. Signed-off-by: Jia Liu <pro...@gmail.com> --- target-openrisc/cpu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c index e348df0..6637166 100644 --- a/target-openrisc/cpu.c +++ b/target-openrisc/cpu.c @@ -100,11 +100,19 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) || - object_class_is_abstract(oc))) { - return NULL; + + if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL + && !object_class_is_abstract(oc)) { + return oc; } - return oc; + + oc = object_class_by_name(cpu_model); + if (oc != NULL && object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) != NULL + && !object_class_is_abstract(oc)) { + return oc; + } + + return NULL; } static void or1200_initfn(Object *obj) -- 1.7.12.4 (Apple Git-37)