From patchwork Tue Jun 14 09:32:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bo Liu X-Patchwork-Id: 12880845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C78A5C433EF for ; Tue, 14 Jun 2022 09:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241587AbiFNJei (ORCPT ); Tue, 14 Jun 2022 05:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230333AbiFNJeg (ORCPT ); Tue, 14 Jun 2022 05:34:36 -0400 X-Greylist: delayed 122 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 14 Jun 2022 02:34:32 PDT Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C2D369D8; Tue, 14 Jun 2022 02:34:32 -0700 (PDT) Received: from ([60.208.111.195]) by unicom146.biz-email.net ((D)) with ASMTP (SSL) id JHV00124; Tue, 14 Jun 2022 17:32:24 +0800 Received: from localhost.localdomain (10.200.104.97) by jtjnmail201602.home.langchao.com (10.100.2.2) with Microsoft SMTP Server id 15.1.2308.27; Tue, 14 Jun 2022 17:32:25 +0800 From: Bo Liu To: CC: , , Bo Liu Subject: [PATCH] KVM: Use consistent type for return value of kvm_mmu_memory_cache_nr_free_objects() Date: Tue, 14 Jun 2022 05:32:22 -0400 Message-ID: <20220614093222.25387-1-liubo03@inspur.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 X-Originating-IP: [10.200.104.97] tUid: 202261417322409c0f72d9200304032c44b936001c900 X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The return value type of the function rmap_can_add() is "bool", and it will returns the result of the function kvm_mmu_memory_cache_nr_free_objects(). So we should change the return value type of kvm_mmu_memory_cache_nr_free_objects() to "bool". Signed-off-by: Bo Liu --- include/linux/kvm_host.h | 2 +- virt/kvm/kvm_main.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index c20f2d55840c..a399a7485795 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -1358,7 +1358,7 @@ void kvm_flush_remote_tlbs(struct kvm *kvm); #ifdef KVM_ARCH_NR_OBJS_PER_MEMORY_CACHE int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min); -int kvm_mmu_memory_cache_nr_free_objects(struct kvm_mmu_memory_cache *mc); +bool kvm_mmu_memory_cache_nr_free_objects(struct kvm_mmu_memory_cache *mc); void kvm_mmu_free_memory_cache(struct kvm_mmu_memory_cache *mc); void *kvm_mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc); #endif diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a67e996cbf7f..2872569e3580 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -394,9 +394,9 @@ int kvm_mmu_topup_memory_cache(struct kvm_mmu_memory_cache *mc, int min) return 0; } -int kvm_mmu_memory_cache_nr_free_objects(struct kvm_mmu_memory_cache *mc) +bool kvm_mmu_memory_cache_nr_free_objects(struct kvm_mmu_memory_cache *mc) { - return mc->nobjs; + return !!mc->nobjs; } void kvm_mmu_free_memory_cache(struct kvm_mmu_memory_cache *mc)