diff options
-rw-r--r-- | qom/cpu.c | 7 | ||||
-rw-r--r-- | target/alpha/cpu.c | 6 | ||||
-rw-r--r-- | target/arm/cpu.c | 4 | ||||
-rw-r--r-- | target/cris/cpu.c | 4 | ||||
-rw-r--r-- | target/lm32/cpu.c | 4 | ||||
-rw-r--r-- | target/m68k/cpu.c | 4 | ||||
-rw-r--r-- | target/mips/cpu.c | 4 | ||||
-rw-r--r-- | target/moxie/cpu.c | 8 | ||||
-rw-r--r-- | target/openrisc/cpu.c | 4 | ||||
-rw-r--r-- | target/sh4/cpu.c | 3 | ||||
-rw-r--r-- | target/sparc/cpu.c | 4 | ||||
-rw-r--r-- | target/tricore/cpu.c | 4 | ||||
-rw-r--r-- | target/unicore32/cpu.c | 4 | ||||
-rw-r--r-- | target/xtensa/cpu.c | 4 |
14 files changed, 8 insertions, 56 deletions
@@ -316,7 +316,12 @@ static bool cpu_common_has_work(CPUState *cs) ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) { - CPUClass *cc = CPU_CLASS(object_class_by_name(typename)); + CPUClass *cc; + + if (!cpu_model) { + return NULL; + } + cc = CPU_CLASS(object_class_by_name(typename)); return cc->class_by_name(cpu_model); } diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index e6c6aabdf0..b8a21f4e01 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -127,14 +127,10 @@ static const AlphaCPUAlias alpha_cpu_aliases[] = { static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc = NULL; + ObjectClass *oc; char *typename; int i; - if (cpu_model == NULL) { - return NULL; - } - oc = object_class_by_name(cpu_model); if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL && !object_class_is_abstract(oc)) { diff --git a/target/arm/cpu.c b/target/arm/cpu.c index f4f601f079..88578f360e 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -939,10 +939,6 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model) char *typename; char **cpuname; - if (!cpu_model) { - return NULL; - } - cpuname = g_strsplit(cpu_model, ",", 1); typename = g_strdup_printf(ARM_CPU_TYPE_NAME("%s"), cpuname[0]); oc = object_class_by_name(typename); diff --git a/target/cris/cpu.c b/target/cris/cpu.c index ceebfed79b..88d93f2d11 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -69,10 +69,6 @@ static ObjectClass *cris_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - #if defined(CONFIG_USER_ONLY) if (strcasecmp(cpu_model, "any") == 0) { return object_class_by_name("crisv32-" TYPE_CRIS_CPU); diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index 2b8c36b6d0..bf081f56d2 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -246,10 +246,6 @@ static ObjectClass *lm32_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = g_strdup_printf("%s-" TYPE_LM32_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 55bf24bae6..8c70e0805c 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -87,10 +87,6 @@ static ObjectClass *m68k_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = g_strdup_printf("%s-" TYPE_M68K_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 1a9a3ed94d..c15b894362 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -166,10 +166,6 @@ static ObjectClass *mips_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = mips_cpu_type_name(cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c index 748d02f29e..30bd44fcad 100644 --- a/target/moxie/cpu.c +++ b/target/moxie/cpu.c @@ -89,13 +89,7 @@ static void moxie_cpu_initfn(Object *obj) static ObjectClass *moxie_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc; - - if (cpu_model == NULL) { - return NULL; - } - - oc = object_class_by_name(cpu_model); + ObjectClass *oc = object_class_by_name(cpu_model); if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_MOXIE_CPU) || object_class_is_abstract(oc))) { return NULL; diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index a979f0bf8b..af9cdcc102 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -108,10 +108,6 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 6ce7cba5a9..252440e019 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -133,9 +133,6 @@ static ObjectClass *superh_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; GSList *list, *item; - if (cpu_model == NULL) { - return NULL; - } if (strcasecmp(cpu_model, "any") == 0) { return object_class_by_name(TYPE_SH7750R_CPU); } diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 0806d699e6..beab90f3e6 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -730,10 +730,6 @@ static ObjectClass *sparc_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = sparc_cpu_type_name(cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 5ab5b56454..871eb35453 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -120,10 +120,6 @@ static ObjectClass *tricore_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (!cpu_model) { - return NULL; - } - typename = g_strdup_printf("%s-" TYPE_TRICORE_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c index c9b78ce68e..138acc9dd8 100644 --- a/target/unicore32/cpu.c +++ b/target/unicore32/cpu.c @@ -44,10 +44,6 @@ static ObjectClass *uc32_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = g_strdup_printf("%s-" TYPE_UNICORE32_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 85897df0a8..dcdc765a86 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -83,10 +83,6 @@ static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model) ObjectClass *oc; char *typename; - if (cpu_model == NULL) { - return NULL; - } - typename = g_strdup_printf("%s-" TYPE_XTENSA_CPU, cpu_model); oc = object_class_by_name(typename); g_free(typename); |