From mboxrd@z Thu Jan 1 00:00:00 1970 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 B3388C433EF for ; Mon, 2 May 2022 13:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385247AbiEBN2Q (ORCPT ); Mon, 2 May 2022 09:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352916AbiEBN1y (ORCPT ); Mon, 2 May 2022 09:27:54 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12719193F1 for ; Mon, 2 May 2022 06:24:18 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4KsP212WPzz4ySv; Mon, 2 May 2022 23:24:09 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1651497854; bh=mC2Kj2FsQGLbwukle8P0U7WJDz+AcbyDLiDbnVAIbco=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=G0CzGoy5f90lqzQ39jqJmnyU4tVEYFt4isrq/7g2xFmI+n7Qhg2/PnCdeuCo5BSVB VD1pp70M/E/l5ex1V2gm/E1hWzrlAwd2gRYEBkj7cfh2R/l6Wjqdcr9v1E1jNsY++7 r/UpYjDLJM/GAYLVV0uqjYE85MsUZidyWVmm5k08wVryjAhvUxUE/QRWe4/gLEmual EDKEOa3wt7jaHVolUf/L8km3zcj+YVlVPikzZ449e1e+QYc80xWz8vCZe62WDpWcUb 18t9u4ud0Voc7xMp1/bp1LmOSzSmkU1WWNQKM6P2Cgx79O0vSAVJbRz0PCKDmRN+Lb 84hxZsYDz4Wzg== From: Michael Ellerman To: CGEL , Benjamin Herrenschmidt , Paul Mackerras , Sandipan Das , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Jing Yangyang , Zeal Robot Subject: Re: [PATCH linux-next] power:pkeys: fix bugon.cocci warnings In-Reply-To: <20210825064228.70487-1-deng.changcheng@zte.com.cn> References: <20210825064228.70487-1-deng.changcheng@zte.com.cn> Date: Mon, 02 May 2022 23:24:07 +1000 Message-ID: <8735hsvzig.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CGEL writes: > From: Jing Yangyang > > Use BUG_ON instead of a if condition followed by BUG. > > ./arch/powerpc/include/asm/book3s/64/pkeys.h:21:2-5:WARNING > Use BUG_ON instead of if condition followed by BUG. > ./arch/powerpc/include/asm/book3s/64/pkeys.h:14:2-5:WARNING > Use BUG_ON instead of if condition followed by BUG. > > Generated by: scripts/coccinelle/misc/bugon.cocci > > Reported-by: Zeal Robot > Signed-off-by: Jing Yangyang > --- > arch/powerpc/include/asm/book3s/64/pkeys.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/pkeys.h b/arch/powerpc/include/asm/book3s/64/pkeys.h > index 5b17813..5f74f0c 100644 > --- a/arch/powerpc/include/asm/book3s/64/pkeys.h > +++ b/arch/powerpc/include/asm/book3s/64/pkeys.h > @@ -10,15 +10,13 @@ static inline u64 vmflag_to_pte_pkey_bits(u64 vm_flags) > if (!mmu_has_feature(MMU_FTR_PKEY)) > return 0x0UL; > > - if (radix_enabled()) > - BUG(); > + BUG_ON(radix_enabled()); > return hash__vmflag_to_pte_pkey_bits(vm_flags); > } > > static inline u16 pte_to_pkey_bits(u64 pteflags) > { > - if (radix_enabled()) > - BUG(); > + BUG_ON(radix_enabled()); > return hash__pte_to_pkey_bits(pteflags); > } Have you checked how this changes the generated code? radix_enabled() is a jump label, via mmu_feature(). Possibly the compiler just works it all out and generates the same code, but I'd want some evidence of that before merging this. cheers