Patch "soc/tegra: fuse: Fix bitwise vs. logical OR warning" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    soc/tegra: fuse: Fix bitwise vs. logical OR warning

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     soc-tegra-fuse-fix-bitwise-vs.-logical-or-warning.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 15880787f026c794dbf811bb43ddf2385d916a48
Author: Nathan Chancellor <nathan@xxxxxxxxxx>
Date:   Fri Dec 10 09:55:29 2021 -0700

    soc/tegra: fuse: Fix bitwise vs. logical OR warning
    
    [ Upstream commit a7083763619f7485ccdade160deb81737cf2732f ]
    
    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: 25cd5a391478 ("ARM: tegra: Add speedo-based process identification")
    Link: https://github.com/ClangBuiltLinux/linux/issues/1488
    Suggested-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
    Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
    Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
    Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index c4f5e5bbb8dce..9397e8ba26469 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -176,7 +176,7 @@ static struct platform_driver tegra_fuse_driver = {
 };
 module_platform_driver(tegra_fuse_driver);
 
-bool __init tegra_fuse_read_spare(unsigned int spare)
+u32 __init tegra_fuse_read_spare(unsigned int spare)
 {
 	unsigned int offset = fuse->soc->info->spare + spare * 4;
 
diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
index 10c2076d5089a..f368bd5373088 100644
--- a/drivers/soc/tegra/fuse/fuse.h
+++ b/drivers/soc/tegra/fuse/fuse.h
@@ -62,7 +62,7 @@ struct tegra_fuse {
 void tegra_init_revision(void);
 void tegra_init_apbmisc(void);
 
-bool __init tegra_fuse_read_spare(unsigned int spare);
+u32 __init tegra_fuse_read_spare(unsigned int spare);
 u32 __init tegra_fuse_read_early(unsigned int offset);
 
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux