From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5882199911827656053==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] RISC-V: fix bugon.cocci warnings Date: Sun, 04 Oct 2020 07:56:42 +0800 Message-ID: <20201003235642.GA29983@489b4183b66a> In-Reply-To: <202010040742.cpWCl5VQ-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============5882199911827656053== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org TO: Atish Patra CC: Palmer Dabbelt CC: Anup Patel CC: Paul Walmsley CC: Albert Ou CC: Zong Li CC: Mike Rapoport CC: Kefeng Wang CC: Yash Shah CC: linux-riscv(a)lists.infradead.org From: kernel test robot arch/riscv/mm/init.c:283:2-5: WARNING: Use BUG_ON instead of if condition f= ollowed by BUG. Please make sure the condition has no side effects (see conditional BUG_ON = definition in include/asm-generic/bug.h) Use BUG_ON instead of a if condition followed by BUG. Semantic patch information: This makes an effort to find cases where BUG() follows an if condition on an expression and replaces the if condition and BUG() with a BUG_ON having the conditional expression of the if statement as argument. Generated by: scripts/coccinelle/misc/bugon.cocci Fixes: e8dcb61f2ade ("RISC-V: Implement late mapping page table allocation = functions") CC: Atish Patra Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git for= -next head: de22d2107ced3cc5355cc9dbbd85e44183546bd5 commit: e8dcb61f2ade040a372d66907d220dd3fdee2505 [19/23] RISC-V: Implement = late mapping page table allocation functions :::::: branch date: 26 hours ago :::::: commit date: 26 hours ago Please take the patch only if it's a positive warning. Thanks! init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -279,8 +279,7 @@ static phys_addr_t alloc_pte_late(uintpt unsigned long vaddr; = vaddr =3D __get_free_page(GFP_KERNEL); - if (!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))) - BUG(); + BUG_ON(!vaddr || !pgtable_pte_page_ctor(virt_to_page(vaddr))); return __pa(vaddr); } =20 --===============5882199911827656053==--