linux/drivers/soc/tegra
Nathan Chancellor a708376361 soc/tegra: fuse: Fix bitwise vs. logical OR warning
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>
2021-12-15 17:19:06 +01:00
..
fuse soc/tegra: fuse: Fix bitwise vs. logical OR warning 2021-12-15 17:19:06 +01:00
ari-tegra186.c soc/tegra: Add Tegra186 ARI driver 2021-10-08 21:42:38 +02:00
common.c soc/tegra: Add devm_tegra_core_dev_init_opp_table() 2021-06-01 12:14:59 +02:00
flowctrl.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
Kconfig soc/tegra: Make regulator couplers depend on CONFIG_REGULATOR 2021-08-02 14:30:46 +02:00
Makefile soc/tegra: Add Tegra186 ARI driver 2021-10-08 21:42:38 +02:00
pmc.c soc/tegra: pmc: Use devm_platform_ioremap_resource() 2021-10-08 21:42:41 +02:00
powergate-bpmp.c soc/tegra: bpmp: Remove unused including <linux/version.h> 2021-08-11 11:51:39 +02:00
regulators-tegra20.c soc/tegra: regulators: Support core domain state syncing 2021-06-02 10:58:55 +02:00
regulators-tegra30.c soc/tegra: regulators: Support core domain state syncing 2021-06-02 10:58:55 +02:00