mirror_ubuntu-kernels/drivers/soc/tegra/fuse
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-tegra20.c soc/tegra: fuse: Enable fuse clock on suspend for Tegra124 2021-08-11 11:55:56 +02:00
fuse-tegra30.c soc/tegra: fuse: Enable fuse clock on suspend for Tegra124 2021-08-11 11:55:56 +02:00
fuse-tegra.c soc/tegra: fuse: Fix bitwise vs. logical OR warning 2021-12-15 17:19:06 +01:00
fuse.h soc/tegra: fuse: Fix bitwise vs. logical OR warning 2021-12-15 17:19:06 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
speedo-tegra20.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
speedo-tegra30.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
speedo-tegra114.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
speedo-tegra124.c soc: tegra: fuse: speedo-tegra124: Remove some set but unused variables 2020-11-10 20:40:49 +01:00
speedo-tegra210.c soc/tegra: fuse: Fix index bug in get_process_id 2020-11-19 11:43:49 +01:00
tegra-apbmisc.c soc/tegra: fuse: Export tegra_read_ram_code() 2020-11-06 19:24:24 +01:00