mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
cpu: Call object_class_dynamic_cast() once in cpu_class_by_name()
For all targets, the CPU class returned from CPUClass::class_by_name() and object_class_dynamic_cast(oc, CPU_RESOLVING_TYPE) need to be compatible. Lets apply the check in cpu_class_by_name() for once, instead of having the check in CPUClass::class_by_name() for individual target. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Gavin Shan <gshan@redhat.com> Message-ID: <20231114235628.534334-4-gshan@redhat.com>
This commit is contained in:
parent
b0b8fa1814
commit
d5be19f514
13 changed files with 16 additions and 49 deletions
|
@ -160,12 +160,8 @@ static void hppa_cpu_initfn(Object *obj)
|
|||
static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
|
||||
{
|
||||
g_autofree char *typename = g_strconcat(cpu_model, "-cpu", NULL);
|
||||
ObjectClass *oc = object_class_by_name(typename);
|
||||
|
||||
if (oc && object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) {
|
||||
return oc;
|
||||
}
|
||||
return NULL;
|
||||
return object_class_by_name(typename);
|
||||
}
|
||||
|
||||
static void hppa_cpu_list_entry(gpointer data, gpointer user_data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue