Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1048208pxb; Thu, 21 Oct 2021 14:50:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt5KseW7CchLPEeHC/zxEk5f32MqM+Nilb2dROkeCo2uWcTJJccNPGQPIymvA8VcOWhFq6 X-Received: by 2002:a05:6402:781:: with SMTP id d1mr10928200edy.313.1634853008994; Thu, 21 Oct 2021 14:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634853008; cv=none; d=google.com; s=arc-20160816; b=pqao3S8OG02e7C9dWI5dLz5fWfY/lDXzc06YWQsD1pibfrZFp373yKoFf5geVB/79U /jCTS6c8rxp+fFl/2uwxcCY+5BZwoKDaKW00aLy14QtPNgq20a8I+borHC8O2hrWS2C9 D1RFF7Vi9BWyLPdOYSocwlRyF2ODAf4LKFDuVhf80pEY1rmfvkKVf9moRBkyf1or65fB LAZC+DDBE1emPLdY5bGC9U2sqULMd9Qnh8tcmKZnCSr9kRnMbRbmeiyIhGxq5hrGyZiJ 0I6cGIKqTPao5fV1CaCS+u7r1UTuybZhlXjfQ9VewnYDmtXLWSiW8iFTAYnK3xxhoooj 68+w== 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=M5D9wa1k0OMp8g3FCI+Wpyi4nlwGblQXrBcat1ecTp8=; b=Gc/HEs4lQR8Ks2jCqrEx9iGhMf/319sludJt0sGTJq/habRFnrhQQFQDEiMsYithmy kI63eOoC3TaBjcpMOdRNyRW7ytmXniTveC/+ruPSuYJur9MjPtiAcQDAx49bRpL8kX7B ZI565pZ1hKb6RRRkzi94Qenk/DwJHQog3SevoY+NbWP9IrnXefo45OB5Jw1gHxuG6L7Y 6xquGH8lxsEzfs6nhLbdTNUjKrT9mO7WQHZij9bmaAmyWiXrOKVBjl74XAsdRTHPs4lG 09mdH4XPh+tuDrLBK1dZUCKIFEQrP7QIoLloLer8G1GGKaHDpH5+chzuhPE0dKFS/auy wIlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bBwP7OED; 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 gh16si8129931ejb.666.2021.10.21.14.49.45; Thu, 21 Oct 2021 14:50:08 -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=bBwP7OED; 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 S231607AbhJUVsE (ORCPT + 99 others); Thu, 21 Oct 2021 17:48:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:32782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231138AbhJUVsB (ORCPT ); Thu, 21 Oct 2021 17:48:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 849616128E; Thu, 21 Oct 2021 21:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634852743; bh=p9AmvMZJ4SxaFh07OaoCvWShpHSr+aSW9gIIO9BOZTw=; h=From:To:Cc:Subject:Date:From; b=bBwP7OEDsqzTMf/0AYeTWcsEI2uc7slCOGDfx1SHqv+y8tM8uMoMQGhuJK+ZxB7sD wbHLmpP+flWiCh6nDTyPMRKkDTtfI9ga9oGCw+bWgm+07WgeVH0gzqCOBAu8IR0u/k 47htRWT7oeJH6GX5mm95sKCeScs59derpi7Mv956FygaUhmOq2aFloG4fvB2uF2JCY hRub63vbT/sot6Ni6/ZBu+nsCkiPheSCEKB5LyR5HYwheGeXS+/+sLx3OsHBTnvAW7 FMfu+qKJu9WLSrwyx25Mx4Ep4KRwF1Shb31sD4MSgusno9nhm6s7eKGpDTJFFDR8wd mJwxWdL6RV2+Q== From: Nathan Chancellor To: Thierry Reding , Jonathan Hunter Cc: Nick Desaulniers , linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor Subject: [PATCH] soc/tegra: fuse: Fix bitwise vs. logical OR warning Date: Thu, 21 Oct 2021 14:45:00 -0700 Message-Id: <20211021214500.2388146-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 instances where boolean expressions are being used with a bitwise OR instead of logical OR: drivers/soc/tegra/fuse/speedo-tegra20.c:72:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] reg = tegra_fuse_read_spare(i) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/soc/tegra/fuse/speedo-tegra20.c:72:9: note: cast one or both operands to int to silence this warning drivers/soc/tegra/fuse/speedo-tegra20.c:87:9: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical] reg = tegra_fuse_read_spare(i) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ || drivers/soc/tegra/fuse/speedo-tegra20.c:87:9: note: cast one or both operands to int to silence this warning 2 warnings 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/1488 Signed-off-by: Nathan Chancellor --- drivers/soc/tegra/fuse/speedo-tegra20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/tegra/fuse/speedo-tegra20.c b/drivers/soc/tegra/fuse/speedo-tegra20.c index 2546bddbab93..4984246605ae 100644 --- a/drivers/soc/tegra/fuse/speedo-tegra20.c +++ b/drivers/soc/tegra/fuse/speedo-tegra20.c @@ -69,7 +69,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info) val = 0; for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) { - reg = tegra_fuse_read_spare(i) | + reg = tegra_fuse_read_spare(i) || tegra_fuse_read_spare(i + CPU_SPEEDO_REDUND_OFFS); val = (val << 1) | (reg & 0x1); } @@ -84,7 +84,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info) val = 0; for (i = SOC_SPEEDO_MSBIT; i >= SOC_SPEEDO_LSBIT; i--) { - reg = tegra_fuse_read_spare(i) | + reg = tegra_fuse_read_spare(i) || tegra_fuse_read_spare(i + SOC_SPEEDO_REDUND_OFFS); val = (val << 1) | (reg & 0x1); } base-commit: 519d81956ee277b4419c723adfb154603c2565ba -- 2.33.1.637.gf443b226ca