Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: selftests: Return an 'unsigned int' from kvm_check_cap()

Return an 'unsigned int' instead of a signed 'int' from kvm_check_cap(),
to make it more obvious that kvm_check_cap() can never return a negative
value due to its assertion that the return is ">= 0".

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Sean Christopherson and committed by
Paolo Bonzini
d8ba3f14 03260452

+3 -3
+1 -1
tools/testing/selftests/kvm/include/kvm_util_base.h
··· 167 167 168 168 int open_path_or_exit(const char *path, int flags); 169 169 int open_kvm_dev_path_or_exit(void); 170 - int kvm_check_cap(long cap); 170 + unsigned int kvm_check_cap(long cap); 171 171 172 172 #define __KVM_SYSCALL_ERROR(_name, _ret) \ 173 173 "%s failed, rc: %i errno: %i (%s)", (_name), (_ret), errno, strerror(errno)
+1 -1
tools/testing/selftests/kvm/kvm_binary_stats_test.c
··· 213 213 } 214 214 215 215 /* Check the extension for binary stats */ 216 - if (kvm_check_cap(KVM_CAP_BINARY_STATS_FD) <= 0) { 216 + if (!kvm_check_cap(KVM_CAP_BINARY_STATS_FD)) { 217 217 print_skip("Binary form statistics interface is not supported"); 218 218 exit(KSFT_SKIP); 219 219 }
+1 -1
tools/testing/selftests/kvm/lib/kvm_util.c
··· 69 69 * Looks up and returns the value corresponding to the capability 70 70 * (KVM_CAP_*) given by cap. 71 71 */ 72 - int kvm_check_cap(long cap) 72 + unsigned int kvm_check_cap(long cap) 73 73 { 74 74 int ret; 75 75 int kvm_fd;