linux/drivers/soc
Nathan Chancellor 12dc89ccaf soc/tegra: fuse: Fix bitwise vs. logical OR warning
[ Upstream commit a708376361 ]

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 instance, tegra_fuse_read_spare() is not semantically returning
a boolean, it is returning a bit value. Use u32 for its return type so
that it can be used with either bitwise or boolean operators without any
warnings.

Fixes: 25cd5a3914 ("ARM: tegra: Add speedo-based process identification")
Link: https://github.com/ClangBuiltLinux/linux/issues/1488
Suggested-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-12-22 09:32:43 +01:00
..
actions
amlogic ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
aspeed soc: aspeed-lpc-ctrl: Fix clock cleanup in error path 2021-08-26 11:31:22 +02:00
atmel
bcm ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
canaan drivers: bus: Delete CONFIG_SIMPLE_PM_BUS 2021-10-05 17:47:22 +02:00
dove
fsl soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read 2021-11-18 19:17:02 +01:00
gemini
imx soc: imx: Register SoC device only on i.MX boards 2021-12-22 09:32:39 +01:00
ixp4xx soc: ixp4xx/qmgr: fix invalid __iomem access 2021-08-03 10:16:34 +02:00
lantiq
litex
mediatek soc: mediatek: mmsys: Fix missing UFOE component in mt8173 table routing 2021-08-06 16:43:23 +02:00
qcom soc: qcom: apr: Add of_node_put() before return 2021-11-18 19:16:55 +01:00
renesas soc: renesas: Prefer memcpy() over strcpy() 2021-08-12 12:36:57 +02:00
rockchip soc: rockchip: io-domain: Remove unneeded semicolon 2021-08-19 23:56:38 +02:00
samsung soc: samsung: exynos-pmu: Fix compilation when nothing selects CONFIG_MFD_CORE 2021-11-18 19:16:01 +01:00
sifive
sunxi
tegra soc/tegra: fuse: Fix bitwise vs. logical OR warning 2021-12-22 09:32:43 +01:00
ti soc: ti: omap-prm: Fix external abort for am335x pruss 2021-09-30 11:30:03 +03:00
ux500
versatile
xilinx
Kconfig
Makefile ARM: ixp4xx: fix compile-testing soc drivers 2021-08-02 14:31:15 +02:00