linux-stable/drivers/soc
Nathan Chancellor bca4a53ea7 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:29:37 +01:00
..
actions
amlogic soc: amlogic: canvas: add missing put_device() call in meson_canvas_get() 2020-12-30 11:51:15 +01:00
aspeed soc: aspeed: p2a-ctrl: Fix boundary check for mmap 2021-09-22 12:26:20 +02:00
atmel drivers: soc: atmel: add null entry at the end of at91_soc_allowed_list[] 2021-02-03 23:25:57 +01:00
bcm
dove
fsl soc: fsl: dpaa2-console: free buffer before returning from dpaa2_console_read 2021-11-17 09:48:45 +01:00
gemini
imx soc: imx: gpc: fix power up sequencing 2020-04-23 10:36:30 +02:00
ixp4xx soc: ixp4xx/qmgr: fix invalid __iomem access 2021-08-12 13:21:04 +02:00
lantiq
mediatek soc: mediatek: Check if power domains can be powered on at boot time 2020-12-30 11:51:01 +01:00
qcom soc: qcom: mdt_loader: Drop PT_LOAD check on hash segment 2021-10-13 10:08:18 +02:00
renesas soc: renesas: rmobile-sysc: Fix some leaks in rmobile_init_pm_domains() 2020-12-30 11:51:01 +01:00
rockchip soc: rockchip: ROCKCHIP_GRF should not default to y, unconditionally 2021-09-15 09:47:30 +02:00
samsung
sunxi
tegra soc/tegra: fuse: Fix bitwise vs. logical OR warning 2021-12-22 09:29:37 +01:00
ti drivers: soc: ti: knav_qmss_queue: Fix error return code in knav_queue_probe 2020-12-30 11:51:10 +01:00
ux500
versatile
xilinx drivers: soc: xilinx: fix firmware driver Kconfig dependency 2020-05-02 08:48:46 +02:00
zte
Kconfig
Makefile