lkml.org 
[lkml]   [2022]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] KVM: x86/mmu: Return true/false from bool function
On Thu, Jun 30, 2022 at 10:50 PM Bo Liu <liubo03@inspur.com> wrote:
>
> Return boolean values ("true" or "false") instead of integer values
> from bool function.
>
> Signed-off-by: Bo Liu <liubo03@inspur.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index bfb50262fd37..572e0c487376 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -1024,7 +1024,7 @@ static bool rmap_can_add(struct kvm_vcpu *vcpu)
> struct kvm_mmu_memory_cache *mc;
>
> mc = &vcpu->arch.mmu_pte_list_desc_cache;
> - return kvm_mmu_memory_cache_nr_free_objects(mc);
> + return !!kvm_mmu_memory_cache_nr_free_objects(mc);

This is entirely unnecessary, since conversion of any scalar type to
bool already converts 0 to false and non-zero to true.

> }
>
> static void rmap_remove(struct kvm *kvm, u64 *spte)
> --
> 2.27.0
>

\
 
 \ /
  Last update: 2022-07-01 15:10    [W:0.032 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site