aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qom/cpu.c14
-rw-r--r--target/i386/cpu.c8
2 files changed, 3 insertions, 19 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index 60292dfde9..92599f3541 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -286,21 +286,12 @@ static bool cpu_common_has_work(CPUState *cs)
ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
{
- CPUClass *cc;
-
- if (!cpu_model) {
- return NULL;
- }
- cc = CPU_CLASS(object_class_by_name(typename));
+ CPUClass *cc = CPU_CLASS(object_class_by_name(typename));
+ assert(cpu_model && cc->class_by_name);
return cc->class_by_name(cpu_model);
}
-static ObjectClass *cpu_common_class_by_name(const char *cpu_model)
-{
- return NULL;
-}
-
static void cpu_common_parse_features(const char *typename, char *features,
Error **errp)
{
@@ -418,7 +409,6 @@ static void cpu_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
CPUClass *k = CPU_CLASS(klass);
- k->class_by_name = cpu_common_class_by_name;
k->parse_features = cpu_common_parse_features;
k->reset = cpu_common_reset;
k->get_arch_id = cpu_common_get_arch_id;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 6bb4ce8719..30b4af897b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -781,13 +781,7 @@ static char *x86_cpu_type_name(const char *model_name)
static ObjectClass *x86_cpu_class_by_name(const char *cpu_model)
{
ObjectClass *oc;
- char *typename;
-
- if (cpu_model == NULL) {
- return NULL;
- }
-
- typename = x86_cpu_type_name(cpu_model);
+ char *typename = x86_cpu_type_name(cpu_model);
oc = object_class_by_name(typename);
g_free(typename);
return oc;