Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1273625iog; Tue, 14 Jun 2022 02:51:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyctY8aKRwCl7/wBf4qWez8GdnCHgsBM9hG1gsY+0GUAmsAyyCF9qZBE8rDNgpNySaVRisN X-Received: by 2002:a17:906:1084:b0:712:2989:b630 with SMTP id u4-20020a170906108400b007122989b630mr3450190eju.344.1655200263734; Tue, 14 Jun 2022 02:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655200263; cv=none; d=google.com; s=arc-20160816; b=vl2iX+EkfEh757GuKQxywT6B670m9yo7f69BG0X7x2BiBaUUisfpKnyRAMDkPfgZDZ rg+Vcmkr7U+jFIbeV4JUSVYK5XOOgt2AA3chjI5lvoz+rm53FpAUf5JqXJFa6vbypEgm cb7WeartJzVJjCW3XudB7feYOsZ4DYHgxGO7j94tkPQHzpWgZYD2kvck89AXlpTHD6lW /cGBvQWYJjhGWAxrxoM0iWG8Yz6qLVzunF1RLcvEPfQ91hxDcJcWiS7jesVgnBatEA+x NSi/e+WEkuIXFkKAdg0MwlgNzpEstu4vAceELJLFxiBFEu160pvWFJU4FhEDATM2kJX5 g12g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:mime-version:message-id :date:subject:cc:to:from; bh=mflHHfPCSu5KUX016a00pzlmSTLsdy0MKeX2195im9s=; b=v+fSS6wrEMQiiXNQz0kv9bq13zxlvxVxznE+Ht0LGECqAxEDZsN0GHOSNvF6O06xED H/dmrNbG8ewf0phYtXkZ2NmoB2LvHTcYQjKYW14iAJwZVXL5I7XJFopCdfDS0DeLd+0G nZoRTQ6FM87Ajqe7qJDG5JkjH7si4R6C4nFVoWBTc2YJ4wFwrn6JeQgP5mIEfArR3nMe 4SHcF3RACtlU9FnOphoaPc7m1y6ZEODF6zEtou8JpK5ZmPpzr/4/PPGDlxv8CwWHdz6n LYMzYHztGy2RZKCj6Gx0zwX5oeisxJ9ajnm4jvuK6wwZuk4VBP5Lb9uZCB/cRZtoZp0e bQmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l21-20020a170906795500b006ff15154daasi11134446ejo.788.2022.06.14.02.50.35; Tue, 14 Jun 2022 02:51:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241616AbiFNJei (ORCPT + 99 others); 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 Content-Type: text/plain 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 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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) -- 2.27.0