mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00: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:
@ -160,13 +160,7 @@ static Property avr_cpu_properties[] = {
|
||||
|
||||
static ObjectClass *avr_cpu_class_by_name(const char *cpu_model)
|
||||
{
|
||||
ObjectClass *oc;
|
||||
|
||||
oc = object_class_by_name(cpu_model);
|
||||
if (object_class_dynamic_cast(oc, TYPE_AVR_CPU) == NULL) {
|
||||
oc = NULL;
|
||||
}
|
||||
return oc;
|
||||
return object_class_by_name(cpu_model);
|
||||
}
|
||||
|
||||
static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
|
||||
|
Reference in New Issue
Block a user