Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1011935pxb; Sat, 30 Oct 2021 03:58:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPjDKDfs3Vfehl7UfQnyXUZP4t9kIAqbIJnCCizirvZ0UmS35Ad0RhX39hzLkqXkIrdiKs X-Received: by 2002:a05:6402:158:: with SMTP id s24mr23305608edu.189.1635591519283; Sat, 30 Oct 2021 03:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635591519; cv=none; d=google.com; s=arc-20160816; b=KsvF5PNY0tiNBJnexYTyOEKTprkMFDcOPizyIfXi4sQ4IcpyWrPe32f4RT2tel9Y+O pBnoDFVMgnQ43Nn+Lr8gAsTldrre7qvbG3uewhQaDnrwtXKacPR88WQs3X8kNKYZl59m wEBEod5uLsUD9SOHnD/iquHapzsvBSuy6+WO5fgWNMAS9czyTy4J6d95Kf3AX8ZFcFMg xHYOpO7J99cWN9sC/yLQtQnuHlMZOobq+lWBrmS/3QPNz0BcceTCz5ERmy2QPPqGA6lS 8Elwif2DSw1sufSawlk9VwZIrVPMh+k/e0d9vFgQT/ylhU39YHKvEYyfkX9yzThQ0QqT dFag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Owxi/n7Fx0SJoSS9cC/e1uduIXAyjAqNAmsPt6qbgto=; b=C6cBeCXZr5TAL/P0yHEanZsDakNwsOePldcCF5dFWbjIIfCW2lnLmXRwZIyvjc/8Hx N5OLoeifxO9tlXnDQY/gKbZpoF9YMyKn7g1Fe4/gXzlFgMZyCG1/SulllE3DPmHXQz7y t5oSiMOyvcJmCWJSCxX+1dy+fbGZRtVobHJ9FaY0teSvweANMo2k2TE0RncWkwGQ7e23 yF8QIWiVWPEEA+Gw7w3ROkS0/SVRNbFrA5L4pED5HDj5yRELZO90QTEcD7c2/+/TowCI setL7HMv2yVOGkGn9vekKZvSQ+IZULp4g5bSUCtcDMAMVtLaAvAVpX9sSrafGX2GPlqb wQRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b="jSkPC/QB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si12321477ejf.272.2021.10.30.03.58.12; Sat, 30 Oct 2021 03:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20210112.gappssmtp.com header.s=20210112 header.b="jSkPC/QB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231830AbhJ3KrC (ORCPT + 99 others); Sat, 30 Oct 2021 06:47:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231792AbhJ3KrA (ORCPT ); Sat, 30 Oct 2021 06:47:00 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5615C061570 for ; Sat, 30 Oct 2021 03:44:30 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so2727814wmd.1 for ; Sat, 30 Oct 2021 03:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Owxi/n7Fx0SJoSS9cC/e1uduIXAyjAqNAmsPt6qbgto=; b=jSkPC/QBK5xxcp1tj1Ts2JvKge7/c8MKntbCcf8Ns9H7K5CPuGw4nxsWOd55iQCYDa xx8QL3r8W92+cfwJySYPd6MSYpDbs/OdfNHOhVWA9iq8pguHoZHRLp2uCKkMIzXnse2m JDQfbk0CA515yZy9pFFoH13I4cHdhUXimkbmg4CiRXlbTkwP3miZlNDH76lMj9KXRkyG 1G6Gjo1o0I/Wl9HZxgSwAlFfW0trEj2DimXUpCa9PvV/PPZXSUzCvLdFhvCK79620jmg nBWWk+QpLWF39LGhElWnvy9B6xje8TPzHnsua9Kr0hMMLpF2NFvDM2kLB6xoTbvza7A8 FnCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Owxi/n7Fx0SJoSS9cC/e1uduIXAyjAqNAmsPt6qbgto=; b=BS+7L4bsuKfTB6JiBUvmKiUL04YSRwPEKRjX1kRytB28TIKZcpWJHuAdBJzMnzY4bJ xxKqU7iEWCIskYFVW3fye8VnU2PjTaLuHOzJa+CYiymgq/4Ch6/WzScpkfYXyjwoApHU ZnEgZAL0MaN8JviDa3YeIfYkn5HZDO4WCqXvIObp0PnsR+pV3jrshkXEoATcAdiv1wFf ve1yLIHCnQWK4FEA7ovN34XLxXSxyzlwJy2/VwjYJaV7khLf2cNvGBs+0NMrX6Y2dXhC L/dj015rLOf9KAHYlIDmddb5TffxczlYXp0UpMp6u2ZOgsrbIaYVyYnKI96IqjhMJ62f o/2Q== X-Gm-Message-State: AOAM533D9nNQkeK7L8iQ03xXqQnU1Y/dCUD9oOXtShkVRPz8CfdLQQOb z55bT7lWGJEGAb33+td/hGjUvlrk7cXLARb++2uB/g== X-Received: by 2002:a05:600c:2f97:: with SMTP id t23mr26595625wmn.59.1635590669104; Sat, 30 Oct 2021 03:44:29 -0700 (PDT) MIME-Version: 1.0 References: <1635319253-100581-1-git-send-email-cuibixuan@linux.alibaba.com> In-Reply-To: <1635319253-100581-1-git-send-email-cuibixuan@linux.alibaba.com> From: Anup Patel Date: Sat, 30 Oct 2021 16:14:17 +0530 Message-ID: Subject: Re: [PATCH -next] RISC-V: KVM: fix boolreturn.cocci warnings To: Bixuan Cui Cc: KVM General , kvm-riscv@lists.infradead.org, linux-riscv , "linux-kernel@vger.kernel.org List" , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 27, 2021 at 12:51 PM Bixuan Cui wrote: > > Fix boolreturn.cocci warnings: > ./arch/riscv/kvm/mmu.c:603:9-10: WARNING: return of 0/1 in function > 'kvm_age_gfn' with return type bool > ./arch/riscv/kvm/mmu.c:582:9-10: WARNING: return of 0/1 in function > 'kvm_set_spte_gfn' with return type bool > ./arch/riscv/kvm/mmu.c:621:9-10: WARNING: return of 0/1 in function > 'kvm_test_age_gfn' with return type bool > ./arch/riscv/kvm/mmu.c:568:9-10: WARNING: return of 0/1 in function > 'kvm_unmap_gfn_range' with return type bool > > Signed-off-by: Bixuan Cui Looks good to me. Applied to riscv_kvm_next, Thanks! Regards, Anup > --- > arch/riscv/kvm/mmu.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c > index 3a00c2d..d81bae8 100644 > --- a/arch/riscv/kvm/mmu.c > +++ b/arch/riscv/kvm/mmu.c > @@ -565,12 +565,12 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, > bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range) > { > if (!kvm->arch.pgd) > - return 0; > + return false; > > stage2_unmap_range(kvm, range->start << PAGE_SHIFT, > (range->end - range->start) << PAGE_SHIFT, > range->may_block); > - return 0; > + return false; > } > > bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) > @@ -579,7 +579,7 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) > kvm_pfn_t pfn = pte_pfn(range->pte); > > if (!kvm->arch.pgd) > - return 0; > + return false; > > WARN_ON(range->end - range->start != 1); > > @@ -587,10 +587,10 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) > __pfn_to_phys(pfn), PAGE_SIZE, true, true); > if (ret) { > kvm_debug("Failed to map stage2 page (error %d)\n", ret); > - return 1; > + return true; > } > > - return 0; > + return false; > } > > bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) > @@ -600,13 +600,13 @@ bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) > u64 size = (range->end - range->start) << PAGE_SHIFT; > > if (!kvm->arch.pgd) > - return 0; > + return false; > > WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PGDIR_SIZE); > > if (!stage2_get_leaf_entry(kvm, range->start << PAGE_SHIFT, > &ptep, &ptep_level)) > - return 0; > + return false; > > return ptep_test_and_clear_young(NULL, 0, ptep); > } > @@ -618,13 +618,13 @@ bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) > u64 size = (range->end - range->start) << PAGE_SHIFT; > > if (!kvm->arch.pgd) > - return 0; > + return false; > > WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PGDIR_SIZE); > > if (!stage2_get_leaf_entry(kvm, range->start << PAGE_SHIFT, > &ptep, &ptep_level)) > - return 0; > + return false; > > return pte_young(*ptep); > } > -- > 1.8.3.1 > > > -- > kvm-riscv mailing list > kvm-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kvm-riscv