Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3314941pxb; Mon, 18 Oct 2021 12:34:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK9Bs6LQeNHIueI9+y3i3kNz+JoX1YpZu7LHRGW2xluSTqghaIFzCTPAUb4BNJl8fr4/1o X-Received: by 2002:a50:9d49:: with SMTP id j9mr46229678edk.39.1634585652441; Mon, 18 Oct 2021 12:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634585652; cv=none; d=google.com; s=arc-20160816; b=jRonuMm4iV9yUvjQtBSwmaZ8kXfYI4CGHsb2waen51+KG0y29D/I5cbIecBpHQdQvB q4r1GOHPgTWTtyRQxtw6T4b1dVUwfNzmQxUr8L1Oz9cmjp6iU3iXV4JJWwiHjbIiaAqC qQpLG2mX6qN/3TPv+qDdC03//eydmxG+zj1EAAmSxisjUMAH/aOLuKXOri7G+mArCTwt MOyTcfsCiHKZ8YHVFGWtonzgENu3Y3Ii2T+r+WWMwkumH0sRdjgxQXiha32DkEpNdTBg WRec2J/OE9MsHjRoaFEdmmmLQ2YoThQhFKqQqDHaMkq/DdmufTh/HP2G19xibBwl3M4i r6fw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=3m+SjB1lfA/u4+3YjUQCIciAzAM0cKREPdsqZ+CDsfM=; b=QtnKl3MNGI84L6E4o/OU3EYAQhCLi7Q72RxE+gFBtx5DpzD6ZLRWSQoFdvAohF6mOS UWf2M3Um4bXt4lt8Sc0KnlsX8H7ASduSTkGzm9k17hkRdRZTcn7mVIPNBuYFo8oWvXfn tbgjjVYmSuBJK/fGqJnTb0QfbyXZPYScyH6tHPulYO/dLH4gDE+9VJIGUBMBN+SbjMK9 9k5JsEF/UqM/xyUdPlQuWJY6tHDUW6UQuuYF+cW/jCOX4q4aS9pMFnRnKIKLaW0B+xy+ kc3jza9rlvbgSFDA80ebghO7TX6tFHQr8xZtGS6w1BtL/F/IhAs7D9/5VVXdDwjsboQf +34w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Zwf9r/8U"; 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 m10si2000857edd.467.2021.10.18.12.33.48; Mon, 18 Oct 2021 12:34:12 -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="Zwf9r/8U"; 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 S231542AbhJRTdf (ORCPT + 99 others); Mon, 18 Oct 2021 15:33:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:49210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232659AbhJRTd3 (ORCPT ); Mon, 18 Oct 2021 15:33:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C68BB6128B; Mon, 18 Oct 2021 19:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634585477; bh=kL+xvgtJucVN4cFRoEIBRAEL92uNVUroLxqy6YYCqFE=; h=From:To:Cc:Subject:Date:From; b=Zwf9r/8UZz6gNf2WZx2ZtEDDZxD6hhqa7tf+X5YVgqhSzDKboXg+OEL0sBsjy7HZh YxCy1HQaFDKXUEHEr5JNNIoZOrLjScbSXvdWkjiX7EHZzc2M7Wz741RgL4n6axrXT3 RiyxwIETKFqOdBCqcoqHk2tPVYrSCYPZz4BHXL2LMf+Op5stL7WhmJxP0k8sVvkukh zoD6kI6BzDp2XNgim1i3Y5x68gj6KVRMdi6Vt4sceyxqcIZP8xatc8bwHuusX1xLtJ W5pLwJI5C1pQWBb+ymmst3p2WDsEyOMe/llZdbWY9SESUoJCYxIu55D4VPTwUXUMW8 xJWZyMn/m8qXA== From: Nathan Chancellor To: Simon Horman , Jakub Kicinski , "David S. Miller" Cc: Nick Desaulniers , oss-drivers@corigine.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH] nfp: bpf: Fix bitwise vs. logical OR warning Date: Mon, 18 Oct 2021 12:31:01 -0700 Message-Id: <20211018193101.2340261-1-nathan@kernel.org> X-Mailer: git-send-email 2.33.1.637.gf443b226ca MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Link: https://github.com/ClangBuiltLinux/linux/issues/1479 Reported-by: Nick Desaulniers Signed-off-by: Nathan Chancellor --- drivers/net/ethernet/netronome/nfp/nfp_asm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_asm.c b/drivers/net/ethernet/netronome/nfp/nfp_asm.c index 2643ea5948f4..154399c5453f 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_asm.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_asm.c @@ -196,7 +196,7 @@ int swreg_to_unrestricted(swreg dst, swreg lreg, swreg rreg, } reg->dst_lmextn = swreg_lmextn(dst); - reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); + reg->src_lmextn = swreg_lmextn(lreg) || swreg_lmextn(rreg); return 0; } @@ -277,7 +277,7 @@ int swreg_to_restricted(swreg dst, swreg lreg, swreg rreg, } reg->dst_lmextn = swreg_lmextn(dst); - reg->src_lmextn = swreg_lmextn(lreg) | swreg_lmextn(rreg); + reg->src_lmextn = swreg_lmextn(lreg) || swreg_lmextn(rreg); return 0; } base-commit: 041c61488236a5a84789083e3d9f0a51139b6edf -- 2.33.1.637.gf443b226ca