* [PATCH v2 1/7] target/s390x/cpu_model: Make check_compatibility() return boolean
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
2024-04-25 3:12 ` [PATCH v2 2/7] target/s390x/cpu_model: Drop local @err in s390_realize_cpu_model() Zhao Liu
` (5 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
As error.h suggested, the best practice for callee is to return
something to indicate success / failure.
With returned boolean, there's no need to check @err.
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/cpu_models.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 8ed3bb6a27b3..8cb47d905fb4 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -510,7 +510,7 @@ static void check_compat_model_failed(Error **errp,
return;
}
-static void check_compatibility(const S390CPUModel *max_model,
+static bool check_compatibility(const S390CPUModel *max_model,
const S390CPUModel *model, Error **errp)
{
ERRP_GUARD();
@@ -518,11 +518,11 @@ static void check_compatibility(const S390CPUModel *max_model,
if (model->def->gen > max_model->def->gen) {
check_compat_model_failed(errp, max_model, "Selected CPU generation is too new");
- return;
+ return false;
} else if (model->def->gen == max_model->def->gen &&
model->def->ec_ga > max_model->def->ec_ga) {
check_compat_model_failed(errp, max_model, "Selected CPU GA level is too new");
- return;
+ return false;
}
#ifndef CONFIG_USER_ONLY
@@ -530,14 +530,14 @@ static void check_compatibility(const S390CPUModel *max_model,
error_setg(errp, "The unpack facility is not compatible with "
"the --only-migratable option. You must remove either "
"the 'unpack' facility or the --only-migratable option");
- return;
+ return false;
}
#endif
/* detect the missing features to properly report them */
bitmap_andnot(missing, model->features, max_model->features, S390_FEAT_MAX);
if (bitmap_empty(missing, S390_FEAT_MAX)) {
- return;
+ return true;
}
error_setg(errp, " ");
@@ -546,6 +546,7 @@ static void check_compatibility(const S390CPUModel *max_model,
"available in the current configuration: ");
error_append_hint(errp,
"Consider a different accelerator, QEMU, or kernel version\n");
+ return false;
}
S390CPUModel *get_max_cpu_model(Error **errp)
@@ -605,8 +606,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp)
cpu->model->cpu_ver = max_model->cpu_ver;
check_consistency(cpu->model);
- check_compatibility(max_model, cpu->model, &err);
- if (err) {
+ if (!check_compatibility(max_model, cpu->model, &err)) {
error_propagate(errp, err);
return;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/7] target/s390x/cpu_model: Drop local @err in s390_realize_cpu_model()
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
2024-04-25 3:12 ` [PATCH v2 1/7] target/s390x/cpu_model: Make check_compatibility() return boolean Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
2024-04-25 3:12 ` [PATCH v2 3/7] target/s390x: Remove KVM stubs in cpu_models.h Zhao Liu
` (4 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
Use @errp to fetch error information directly and drop the local
variable @err.
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/cpu_models.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 8cb47d905fb4..052540a866ac 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -577,7 +577,6 @@ S390CPUModel *get_max_cpu_model(Error **errp)
void s390_realize_cpu_model(CPUState *cs, Error **errp)
{
ERRP_GUARD();
- Error *err = NULL;
S390CPUClass *xcc = S390_CPU_GET_CLASS(cs);
S390CPU *cpu = S390_CPU(cs);
const S390CPUModel *max_model;
@@ -606,8 +605,7 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp)
cpu->model->cpu_ver = max_model->cpu_ver;
check_consistency(cpu->model);
- if (!check_compatibility(max_model, cpu->model, &err)) {
- error_propagate(errp, err);
+ if (!check_compatibility(max_model, cpu->model, errp)) {
return;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/7] target/s390x: Remove KVM stubs in cpu_models.h
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
2024-04-25 3:12 ` [PATCH v2 1/7] target/s390x/cpu_model: Make check_compatibility() return boolean Zhao Liu
2024-04-25 3:12 ` [PATCH v2 2/7] target/s390x/cpu_model: Drop local @err in s390_realize_cpu_model() Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
2024-04-25 3:12 ` [PATCH v2 4/7] target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean Zhao Liu
` (3 subsequent siblings)
6 siblings, 0 replies; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Since the calls are elided when KVM is not available,
we can remove the stubs (which are never compiled).
Inspired-by: Thomas Huth <thuth@redhat.com>>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
target/s390x/cpu_models.h | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
index d7b89129891a..a89c2a15ab54 100644
--- a/target/s390x/cpu_models.h
+++ b/target/s390x/cpu_models.h
@@ -114,23 +114,8 @@ static inline uint64_t s390_cpuid_from_cpu_model(const S390CPUModel *model)
S390CPUDef const *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
S390FeatBitmap features);
-#ifdef CONFIG_KVM
bool kvm_s390_cpu_models_supported(void);
void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp);
void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp);
-#else
-static inline void kvm_s390_get_host_cpu_model(S390CPUModel *model,
- Error **errp)
-{
-}
-static inline void kvm_s390_apply_cpu_model(const S390CPUModel *model,
- Error **errp)
-{
-}
-static inline bool kvm_s390_cpu_models_supported(void)
-{
- return false;
-}
-#endif
#endif /* TARGET_S390X_CPU_MODELS_H */
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/7] target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
` (2 preceding siblings ...)
2024-04-25 3:12 ` [PATCH v2 3/7] target/s390x: Remove KVM stubs in cpu_models.h Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
2024-04-25 15:22 ` Thomas Huth
2024-04-25 3:12 ` [PATCH v2 5/7] target/s390x/cpu_models: Drop local @err in get_max_cpu_model() Zhao Liu
` (2 subsequent siblings)
6 siblings, 1 reply; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
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>
---
target/s390x/cpu_models.c | 9 ++++-----
target/s390x/cpu_models.h | 2 +-
target/s390x/kvm/kvm.c | 13 +++++++------
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 052540a866ac..a0e4acb707d7 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;
}
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
index a89c2a15ab54..c14aff6c10eb 100644
--- a/target/s390x/cpu_models.h
+++ b/target/s390x/cpu_models.h
@@ -115,7 +115,7 @@ S390CPUDef const *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
S390FeatBitmap features);
bool kvm_s390_cpu_models_supported(void);
-void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp);
+bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp);
void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp);
#endif /* TARGET_S390X_CPU_MODELS_H */
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 4dcd757cdcc3..2c3e05cae3ad 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -2375,7 +2375,7 @@ bool kvm_s390_cpu_models_supported(void)
KVM_S390_VM_CPU_MACHINE_SUBFUNC);
}
-void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
+bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
{
struct kvm_s390_vm_cpu_machine prop = {};
struct kvm_device_attr attr = {
@@ -2390,14 +2390,14 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
if (!kvm_s390_cpu_models_supported()) {
error_setg(errp, "KVM doesn't support CPU models");
- return;
+ return false;
}
/* query the basic cpu model properties */
rc = kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr);
if (rc) {
error_setg(errp, "KVM: Error querying host CPU model: %d", rc);
- return;
+ return false;
}
cpu_type = cpuid_type(prop.cpuid);
@@ -2420,13 +2420,13 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
rc = query_cpu_feat(model->features);
if (rc) {
error_setg(errp, "KVM: Error querying CPU features: %d", rc);
- return;
+ return false;
}
/* get supported cpu subfunctions indicated via query / test bit */
rc = query_cpu_subfunc(model->features);
if (rc) {
error_setg(errp, "KVM: Error querying CPU subfunctions: %d", rc);
- return;
+ return false;
}
/* PTFF subfunctions might be indicated although kernel support missing */
@@ -2482,7 +2482,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
}
if (!model->def) {
error_setg(errp, "KVM: host CPU model could not be identified");
- return;
+ return false;
}
/* for now, we can only provide the AP feature with HW support */
if (ap_available()) {
@@ -2506,6 +2506,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
/* strip of features that are not part of the maximum model */
bitmap_and(model->features, model->features, model->def->full_feat,
S390_FEAT_MAX);
+ return true;
}
static int configure_uv_feat_guest(const S390FeatBitmap features)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/7] target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean
2024-04-25 3:12 ` [PATCH v2 4/7] target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean Zhao Liu
@ 2024-04-25 15:22 ` Thomas Huth
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Huth @ 2024-04-25 15:22 UTC (permalink / raw)
To: Zhao Liu, David Hildenbrand, Richard Henderson, Ilya Leoshkevich,
Halil Pasic, Christian Borntraeger, Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel
On 25/04/2024 05.12, Zhao Liu wrote:
> 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>
> ---
> target/s390x/cpu_models.c | 9 ++++-----
> target/s390x/cpu_models.h | 2 +-
> target/s390x/kvm/kvm.c | 13 +++++++------
> 3 files changed, 12 insertions(+), 12 deletions(-)
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 5/7] target/s390x/cpu_models: Drop local @err in get_max_cpu_model()
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
` (3 preceding siblings ...)
2024-04-25 3:12 ` [PATCH v2 4/7] target/s390x/cpu_models: Make kvm_s390_get_host_cpu_model() return boolean Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
2024-04-25 3:12 ` [PATCH v2 6/7] target/s390x/cpu_models: Make kvm_s390_apply_cpu_model() return boolean Zhao Liu
2024-04-25 3:12 ` [PATCH v2 7/7] target/s390x/cpu_models_sysemu: Drop local @err in apply_cpu_model() Zhao Liu
6 siblings, 0 replies; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
Use @errp to fetch error information directly and drop the local
variable @err.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/cpu_models.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index a0e4acb707d7..aae452cfd3fc 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -551,7 +551,6 @@ static bool check_compatibility(const S390CPUModel *max_model,
S390CPUModel *get_max_cpu_model(Error **errp)
{
- Error *err = NULL;
static S390CPUModel max_model;
static bool cached;
@@ -560,8 +559,7 @@ S390CPUModel *get_max_cpu_model(Error **errp)
}
if (kvm_enabled()) {
- if (!kvm_s390_get_host_cpu_model(&max_model, &err)) {
- error_propagate(errp, err);
+ if (!kvm_s390_get_host_cpu_model(&max_model, errp)) {
return NULL;
}
} else {
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 6/7] target/s390x/cpu_models: Make kvm_s390_apply_cpu_model() return boolean
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
` (4 preceding siblings ...)
2024-04-25 3:12 ` [PATCH v2 5/7] target/s390x/cpu_models: Drop local @err in get_max_cpu_model() Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
2024-04-25 3:12 ` [PATCH v2 7/7] target/s390x/cpu_models_sysemu: Drop local @err in apply_cpu_model() Zhao Liu
6 siblings, 0 replies; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
As error.h suggested, the best practice for callee is to return
something to indicate success / failure.
So make kvm_s390_apply_cpu_model() return boolean and check the
returned boolean in apply_cpu_model() instead of accessing @err.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/cpu_models.h | 2 +-
target/s390x/cpu_models_sysemu.c | 3 +--
target/s390x/kvm/kvm.c | 15 ++++++++-------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
index c14aff6c10eb..71d4bc2dd4a2 100644
--- a/target/s390x/cpu_models.h
+++ b/target/s390x/cpu_models.h
@@ -116,6 +116,6 @@ S390CPUDef const *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
bool kvm_s390_cpu_models_supported(void);
bool kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp);
-void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp);
+bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp);
#endif /* TARGET_S390X_CPU_MODELS_H */
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
index 2d99218069cb..bf855c659d5e 100644
--- a/target/s390x/cpu_models_sysemu.c
+++ b/target/s390x/cpu_models_sysemu.c
@@ -405,8 +405,7 @@ void apply_cpu_model(const S390CPUModel *model, Error **errp)
}
if (kvm_enabled()) {
- kvm_s390_apply_cpu_model(model, &err);
- if (err) {
+ if (!kvm_s390_apply_cpu_model(model, &err)) {
error_propagate(errp, err);
return;
}
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 2c3e05cae3ad..1b494ecc2076 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -2543,7 +2543,7 @@ static void kvm_s390_configure_apie(bool interpret)
}
}
-void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
+bool kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
{
struct kvm_s390_vm_cpu_processor prop = {
.fac_list = { 0 },
@@ -2560,11 +2560,11 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
if (kvm_s390_cmma_available()) {
kvm_s390_enable_cmma();
}
- return;
+ return true;
}
if (!kvm_s390_cpu_models_supported()) {
error_setg(errp, "KVM doesn't support CPU models");
- return;
+ return false;
}
prop.cpuid = s390_cpuid_from_cpu_model(model);
prop.ibc = s390_ibc_from_cpu_model(model);
@@ -2574,19 +2574,19 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
if (rc) {
error_setg(errp, "KVM: Error configuring the CPU model: %d", rc);
- return;
+ return false;
}
/* configure cpu features indicated e.g. via SCLP */
rc = configure_cpu_feat(model->features);
if (rc) {
error_setg(errp, "KVM: Error configuring CPU features: %d", rc);
- return;
+ return false;
}
/* configure cpu subfunctions indicated via query / test bit */
rc = configure_cpu_subfunc(model->features);
if (rc) {
error_setg(errp, "KVM: Error configuring CPU subfunctions: %d", rc);
- return;
+ return false;
}
/* enable CMM via CMMA */
if (test_bit(S390_FEAT_CMM, model->features)) {
@@ -2601,8 +2601,9 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
rc = configure_uv_feat_guest(model->features);
if (rc) {
error_setg(errp, "KVM: Error configuring CPU UV features %d", rc);
- return;
+ return false;
}
+ return true;
}
void kvm_s390_restart_interrupt(S390CPU *cpu)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 7/7] target/s390x/cpu_models_sysemu: Drop local @err in apply_cpu_model()
2024-04-25 3:12 [PATCH v2 0/7] s390x/cpu_models: Misc cleanup on returned error code and local @err variables Zhao Liu
` (5 preceding siblings ...)
2024-04-25 3:12 ` [PATCH v2 6/7] target/s390x/cpu_models: Make kvm_s390_apply_cpu_model() return boolean Zhao Liu
@ 2024-04-25 3:12 ` Zhao Liu
6 siblings, 0 replies; 9+ messages in thread
From: Zhao Liu @ 2024-04-25 3:12 UTC (permalink / raw)
To: Thomas Huth, David Hildenbrand, Richard Henderson,
Ilya Leoshkevich, Halil Pasic, Christian Borntraeger,
Philippe Mathieu-Daudé
Cc: qemu-s390x, qemu-devel, Zhao Liu
Use @errp to fetch error information directly and drop the local
variable @err.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/cpu_models_sysemu.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
index bf855c659d5e..15be729c3d48 100644
--- a/target/s390x/cpu_models_sysemu.c
+++ b/target/s390x/cpu_models_sysemu.c
@@ -389,7 +389,6 @@ CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *infoa,
void apply_cpu_model(const S390CPUModel *model, Error **errp)
{
- Error *err = NULL;
static S390CPUModel applied_model;
static bool applied;
@@ -405,8 +404,7 @@ void apply_cpu_model(const S390CPUModel *model, Error **errp)
}
if (kvm_enabled()) {
- if (!kvm_s390_apply_cpu_model(model, &err)) {
- error_propagate(errp, err);
+ if (!kvm_s390_apply_cpu_model(model, errp)) {
return;
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread