[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 19/32] target/xtensa: Improve xtensa_cpu_class_by_name()
From: |
Gavin Shan |
Subject: |
[PATCH v3 19/32] target/xtensa: Improve xtensa_cpu_class_by_name() |
Date: |
Thu, 7 Sep 2023 10:35:40 +1000 |
Improve xtensa_cpu_class_by_name() by merging the condition of
'@oc == NULL' to object_class_dynamic_cast().
Signed-off-by: Gavin Shan <gshan@redhat.com>
---
target/xtensa/cpu.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index acaf8c905f..9d682611aa 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -141,11 +141,12 @@ static ObjectClass *xtensa_cpu_class_by_name(const char
*cpu_model)
typename = g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), cpu_model);
oc = object_class_by_name(typename);
g_free(typename);
- if (oc == NULL || !object_class_dynamic_cast(oc, TYPE_XTENSA_CPU) ||
- object_class_is_abstract(oc)) {
- return NULL;
+ if (object_class_dynamic_cast(oc, TYPE_XTENSA_CPU) &&
+ !object_class_is_abstract(oc)) {
+ return oc;
}
- return oc;
+
+ return NULL;
}
static void xtensa_cpu_disas_set_info(CPUState *cs, disassemble_info *info)
--
2.41.0
- Re: [PATCH v3 15/32] target/s390x: Use generic helper to show CPU model names, (continued)
Re: [PATCH v3 15/32] target/s390x: Use generic helper to show CPU model names, Thomas Huth, 2023/09/07
[PATCH v3 16/32] target/sh4: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
[PATCH v3 17/32] target/tricore: Use generic helper to show CPU model names, Gavin Shan, 2023/09/06
[PATCH v3 18/32] target/sparc: Improve sparc_cpu_class_by_name(), Gavin Shan, 2023/09/06
[PATCH v3 19/32] target/xtensa: Improve xtensa_cpu_class_by_name(),
Gavin Shan <=
[PATCH v3 20/32] target/hppa: Implement hppa_cpu_list(), Gavin Shan, 2023/09/06
[PATCH v3 21/32] target/microblaze: Implement microblaze_cpu_list(), Gavin Shan, 2023/09/06
[PATCH v3 22/32] target/nios2: Implement nios2_cpu_list(), Gavin Shan, 2023/09/06
[PATCH v3 23/32] Mark cpu_list() supported on all targets, Gavin Shan, 2023/09/06
[PATCH v3 24/32] machine: Constify MachineClass::valid_cpu_types[i], Gavin Shan, 2023/09/06
[PATCH v3 25/32] machine: Use error handling when CPU type is checked, Gavin Shan, 2023/09/06
[PATCH v3 26/32] machine: Introduce helper is_cpu_type_supported(), Gavin Shan, 2023/09/06
[PATCH v3 27/32] machine: Print CPU model name instead of CPU type name, Gavin Shan, 2023/09/06