diff options
author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2021-04-27 03:31:38 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-04-26 05:28:25 -0400 |
commit | d4787579d2133370ab47963c6527e79731df5b2a (patch) | |
tree | a3bae38c312e49f665e96a7caddcbaff5ab795f4 /tools/testing/selftests/kvm | |
parent | 10dbdf98acd620f376313b85b587c9b9563fc170 (diff) | |
download | linux-d4787579d2133370ab47963c6527e79731df5b2a.tar.bz2 |
selftests: kvm: Fix the check of return value
In vm_vcpu_rm() and kvm_vm_release(), a stale return value is checked in
TEST_ASSERT macro.
Fix it by assigning variable ret with correct return value.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Message-Id: <20210426193138.118276-1-zhenzhong.duan@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm')
-rw-r--r-- | tools/testing/selftests/kvm/lib/kvm_util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 8926f91d1a98..fc83f6c5902d 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -520,7 +520,7 @@ static void vm_vcpu_rm(struct kvm_vm *vm, struct vcpu *vcpu) ret = munmap(vcpu->state, vcpu_mmap_sz()); TEST_ASSERT(ret == 0, "munmap of VCPU fd failed, rc: %i " "errno: %i", ret, errno); - close(vcpu->fd); + ret = close(vcpu->fd); TEST_ASSERT(ret == 0, "Close of VCPU fd failed, rc: %i " "errno: %i", ret, errno); @@ -540,7 +540,7 @@ void kvm_vm_release(struct kvm_vm *vmp) TEST_ASSERT(ret == 0, "Close of vm fd failed,\n" " vmp->fd: %i rc: %i errno: %i", vmp->fd, ret, errno); - close(vmp->kvm_fd); + ret = close(vmp->kvm_fd); TEST_ASSERT(ret == 0, "Close of /dev/kvm fd failed,\n" " vmp->kvm_fd: %i rc: %i errno: %i", vmp->kvm_fd, ret, errno); } |