aboutsummaryrefslogtreecommitdiff
path: root/qom/cpu.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2017-09-17 20:28:42 -0300
committerEduardo Habkost <ehabkost@redhat.com>2017-10-09 23:21:52 -0300
commit8301ea444abb49f7b7fb939b09c1e23b22977f30 (patch)
tree22dc7963464b3615aa96e96d6d873f1fb072c74d /qom/cpu.c
parent530049bc1dcc24c1178a29d99ca08b6dd08413e0 (diff)
qom/cpu: move cpu_model null check to cpu_class_by_name()
and clean every implementation. Suggested-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20170917232842.14544-1-f4bug@amsat.org> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'qom/cpu.c')
-rw-r--r--qom/cpu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/qom/cpu.c b/qom/cpu.c
index 94fa8fe005..54c9452b1c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -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);
}