[qom-cpu,for-1.4,05/14] target-alpha: Detect attempt to instantiate non-CPU type in cpu_init()

Submitted by Andreas Färber on Jan. 23, 2013, 12:07 p.m.

Details

Message ID 1358942867-8612-6-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Jan. 23, 2013, 12:07 p.m.
Check in alpha_cpu_class_by_name() whether the type found is actually
(a sub-type of) TYPE_ALPHA_CPU.

This fixes, e.g., -cpu typhoon-pcihost asserting.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-alpha/cpu.c |    2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

Patch hide | download patch | download mbox

diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 3ac0fde..0d6975e 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -96,7 +96,7 @@  static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
     }
 
     oc = object_class_by_name(cpu_model);
-    if (oc != NULL) {
+    if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL) {
         return oc;
     }