diff options
author | Markus Armbruster <armbru@redhat.com> | 2021-07-20 14:54:01 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-08-26 17:15:28 +0200 |
commit | 436c831a281ed950110dbc3e3baea24054c37298 (patch) | |
tree | ba538a264b92b5598ec31e177423335f59b22738 /target/i386 | |
parent | 650126f838f763fe02f5b41584fd9f13cb8cbf13 (diff) |
migration: Unify failure check for migrate_add_blocker()
Most callers check the return value. Some check whether it set an
error. Functionally equivalent, but the former tends to be easier on
the eyes, so do that everywhere.
Prior art: commit c6ecec43b2 "qemu-option: Check return value instead
of @err where convenient".
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-10-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'target/i386')
-rw-r--r-- | target/i386/kvm/kvm.c | 6 | ||||
-rw-r--r-- | target/i386/nvmm/nvmm-all.c | 3 | ||||
-rw-r--r-- | target/i386/whpx/whpx-all.c | 3 |
3 files changed, 5 insertions, 7 deletions
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 57aed525b5..500d2e0e68 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -1435,7 +1435,7 @@ static int hyperv_init_vcpu(X86CPU *cpu) "'hv-passthrough' CPU flag prevents migration, use explicit" " set of hv-* flags instead"); ret = migrate_add_blocker(hv_passthrough_mig_blocker, &local_err); - if (local_err) { + if (ret < 0) { error_report_err(local_err); return ret; } @@ -1449,7 +1449,7 @@ static int hyperv_init_vcpu(X86CPU *cpu) " make sure SMT is disabled and/or that vCPUs are properly" " pinned)"); ret = migrate_add_blocker(hv_no_nonarch_cs_mig_blocker, &local_err); - if (local_err) { + if (ret < 0) { error_report_err(local_err); return ret; } @@ -1888,7 +1888,7 @@ int kvm_arch_init_vcpu(CPUState *cs) "State blocked by non-migratable CPU device" " (invtsc flag)"); r = migrate_add_blocker(invtsc_mig_blocker, &local_err); - if (local_err) { + if (r < 0) { error_report_err(local_err); return r; } diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index 7bb0d9e30e..28dee4c5ee 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -926,8 +926,7 @@ nvmm_init_vcpu(CPUState *cpu) error_setg(&nvmm_migration_blocker, "NVMM: Migration not supported"); - (void)migrate_add_blocker(nvmm_migration_blocker, &local_error); - if (local_error) { + if (migrate_add_blocker(nvmm_migration_blocker, &local_error) < 0) { error_report_err(local_error); error_free(nvmm_migration_blocker); return -EINVAL; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index cc8c0b984b..3e925b9da7 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1346,8 +1346,7 @@ int whpx_init_vcpu(CPUState *cpu) "State blocked due to non-migratable CPUID feature support," "dirty memory tracking support, and XSAVE/XRSTOR support"); - (void)migrate_add_blocker(whpx_migration_blocker, &local_error); - if (local_error) { + if (migrate_add_blocker(whpx_migration_blocker, &local_error) < 0) { error_report_err(local_error); error_free(whpx_migration_blocker); ret = -EINVAL; |