diff options
author | Andreas Färber <afaerber@suse.de> | 2013-01-23 12:28:22 +0100 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-01-27 23:33:34 +0100 |
commit | a120c287086e0b03a57f1f4ac7d7aa73fe3d1fe7 (patch) | |
tree | 329d9d73ea145988851c6fed09ca3110de58bf46 /target-alpha | |
parent | 178623789465287624c48f7ef12d0ab83a1dc380 (diff) |
target-alpha: Catch attempt to instantiate abstract type in cpu_init()
This fixes -cpu alpha-cpu asserting.
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-alpha')
-rw-r--r-- | target-alpha/cpu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c index 0d6975ea9b..0ad69f0859 100644 --- a/target-alpha/cpu.c +++ b/target-alpha/cpu.c @@ -96,14 +96,15 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) } oc = object_class_by_name(cpu_model); - if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL) { + if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL && + !object_class_is_abstract(oc)) { return oc; } for (i = 0; i < ARRAY_SIZE(alpha_cpu_aliases); i++) { if (strcmp(cpu_model, alpha_cpu_aliases[i].alias) == 0) { oc = object_class_by_name(alpha_cpu_aliases[i].typename); - assert(oc != NULL); + assert(oc != NULL && !object_class_is_abstract(oc)); return oc; } } @@ -111,6 +112,9 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf("%s-" TYPE_ALPHA_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); + if (oc != NULL && object_class_is_abstract(oc)) { + oc = NULL; + } return oc; } |