Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3416508pxb; Mon, 18 Oct 2021 14:58:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvm8cMugS8/rAq85aw9KS1QCdIXZVsM1R3auyv2CiXkm8/AiWk+ufScFCp7jPJ8GBSTHae X-Received: by 2002:a17:906:4950:: with SMTP id f16mr32126734ejt.297.1634594313262; Mon, 18 Oct 2021 14:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634594313; cv=none; d=google.com; s=arc-20160816; b=u6y9/mPGLgCXbh/0lTXZ+5Yni9Ib7oUS+DdrJ6w15UxllGyuMyic+qjH6idwIuUNmM wgyrRlzuCxNB9EZZC3k367l4F90Twtl4StOaJrxG972q+mB/DdJUxXrnx1fKp/zpinl3 U/PlxHP+DPkjzZBqZ+oHmkR0yrY7PFkMTwG1Y1yI6CH/xiZ/YvKA4MZHsWlPIw2/7zS7 sCMoEZRnMWqLNR5FKhq5vSqsSMGxVS+t413979APuAIHOqbNZxN1ZpBrJ+R+MqmpYQJO 4Y8Iv9XQ4CFslC0JGxsOMESHlPjck26Z+XqB0MtTEGExeo3l4MZxd7YWpU23Z5VmpaWg frAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kcuYtXoZYRt8yLFmWPtrfEF26r/mxwGNJY7DHnCfJGA=; b=gEMoV08/7D/bT2K/e7961VIN34N8yOWuRUr6pS47wNw31SBt6jlc4TqEJTYegn8GeB oHXu+NYH5btEPKC9MVMQUb7upNx10DwsGou/BplUGq4r9aKLBOFsiRDKxNIhgcXvDEye +LdrNRXNjq68wfwo3niGzUQsHzUEg22pOW58e0Y1+clfy3YVR1UW2o5MKQWQEbchHRnZ WoE4cCT4Gvh5WEqWFr7x3ibLoMx/RipwIN4+oCzLKGfLgzmnwzSolpp9mJMIBYSmqM6h AQqzPOxeh6pW1QS8Zn2YepESWEp5ZYwuc29YfloAsvvidEDez8XazXiGThTqAUeTwdl2 UubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i9WV+sET; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ky10si22377911ejc.214.2021.10.18.14.58.07; Mon, 18 Oct 2021 14:58:33 -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=@kernel.org header.s=k20201202 header.b=i9WV+sET; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232628AbhJRV4R (ORCPT + 99 others); Mon, 18 Oct 2021 17:56:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:41826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhJRV4Q (ORCPT ); Mon, 18 Oct 2021 17:56:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0EFFC60E78; Mon, 18 Oct 2021 21:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634594044; bh=guCARVySqwCJZT5ZkTzkfBsy7YHlyNBrOFj19+oPouU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=i9WV+sETDEhFbs0dI9M5awwTTArvYOIynxt+7hzRlTujLWZnPelzWRnDnFUC3d5zQ hu+tXWjWI3icrRsC9EtkoovNeeE0bjXmvfwmF65z/xxtgGa4Tt3+XvptQz97nvvdu7 WMu++VqdCo82pPmAiCPGmsCQ6T0rQ5ishE0uHQQGilTBqndfVMtRoVwSHs0PnWcZ0R 31PcOVqPORUkOkPOuZzYgXKrvP6YhF2QReDXC16/s66xAQa4CwtQ6/QPSAdSaVVnKx iEc7WMM3Z6FNJvje05/En7pJypOyxJ8XGRBZxlZLq9H5cw8m9Tc1+SOxUt56sreyqN QFkrtJ7FnNSHg== Date: Mon, 18 Oct 2021 14:54:03 -0700 From: Jakub Kicinski To: Nathan Chancellor Cc: Simon Horman , "David S. Miller" , Nick Desaulniers , oss-drivers@corigine.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] nfp: bpf: Fix bitwise vs. logical OR warning Message-ID: <20211018145403.5eb2807d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20211018193101.2340261-1-nathan@kernel.org> References: <20211018193101.2340261-1-nathan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Oct 2021 12:31:01 -0700 Nathan Chancellor wrote: > A new warning in clang points out two places in this driver where > boolean expressions are being used with a bitwise OR instead of a > logical one: > > drivers/net/ethernet/netronome/nfp/nfp_asm.c:199:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] > reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > || > drivers/net/ethernet/netronome/nfp/nfp_asm.c:199:20: note: cast one or both operands to int to silence this warning > drivers/net/ethernet/netronome/nfp/nfp_asm.c:280:20: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical] > reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > || > drivers/net/ethernet/netronome/nfp/nfp_asm.c:280:20: note: cast one or both operands to int to silence this warning > 2 errors generated. > > The motivation for the warning is that logical operations short circuit > while bitwise operations do not. In this case, it does not seem like > short circuiting is harmful so implement the suggested fix of changing > to a logical operation to fix the warning. Warning seems generally useful, although in this case it is a little out of place (swreg_lmextn() is a field extractor after all). Applied to net, but without the Fixes tag, thanks!