cpu: drop unnecessary NULL check and cpu_common_class_by_name()

both do nothing as for the first all callers
parse_cpu_model() and qmp_query_cpu_model_()
should provide non NULL value, so just abort if it's not so.

While at it drop cpu_common_class_by_name() which is not need
any more as every target has CPUClass::class_by_name callback
by now, though abort in case a new arch will forget to define one.

Backports commit 99193d8f2ef594648ad67cc3d007b0e4fb2f8cf8 from qemu
This commit is contained in:
Igor Mammedov 2018-03-20 14:23:44 -04:00 committed by Lioncash
parent cd27da0d88
commit 415b11ee49
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -176,13 +176,9 @@ static bool cpu_common_debug_check_watchpoint(CPUState *cpu, CPUWatchpoint *wp)
ObjectClass *cpu_class_by_name(struct uc_struct *uc, const char *typename, const char *cpu_model) ObjectClass *cpu_class_by_name(struct uc_struct *uc, const char *typename, const char *cpu_model)
{ {
CPUClass *cc; CPUClass *cc = CPU_CLASS(uc, object_class_by_name(uc, typename));
if (!cpu_model) {
return NULL;
}
cc = CPU_CLASS(uc, object_class_by_name(uc, typename));
assert(cpu_model && cc->class_by_name);
return cc->class_by_name(uc, cpu_model); return cc->class_by_name(uc, cpu_model);
} }