diff options
| author | Zhao Liu <zhao1.liu@intel.com> | 2024-04-25 11:12:29 +0800 |
|---|---|---|
| committer | Thomas Huth <thuth@redhat.com> | 2024-04-30 06:21:47 +0200 |
| commit | 47ab3b21374627419cd400141cacd534b9281f7b (patch) | |
| tree | 1cc821d1e981b6731cae4e89c2e5ae83aabb479e /target/s390x/cpu_models.c | |
| parent | 9c2df9c5e849ce2c24a6518a56e6e44371ff541e (diff) | |
| download | focaccia-qemu-47ab3b21374627419cd400141cacd534b9281f7b.tar.gz focaccia-qemu-47ab3b21374627419cd400141cacd534b9281f7b.zip | |
target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean
As error.h suggested, the best practice for callee is to return something to indicate success / failure. So make kvm_s390_get_host_cpu_model() return boolean and check the returned boolean in get_max_cpu_model() instead of accessing @err. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20240425031232.1586401-5-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'target/s390x/cpu_models.c')
| -rw-r--r-- | target/s390x/cpu_models.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 052540a866..a0e4acb707 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -560,16 +560,15 @@ S390CPUModel *get_max_cpu_model(Error **errp) } if (kvm_enabled()) { - kvm_s390_get_host_cpu_model(&max_model, &err); + if (!kvm_s390_get_host_cpu_model(&max_model, &err)) { + error_propagate(errp, err); + return NULL; + } } else { max_model.def = s390_find_cpu_def(QEMU_MAX_CPU_TYPE, QEMU_MAX_CPU_GEN, QEMU_MAX_CPU_EC_GA, NULL); bitmap_copy(max_model.features, qemu_max_cpu_feat, S390_FEAT_MAX); } - if (err) { - error_propagate(errp, err); - return NULL; - } cached = true; return &max_model; } |