* [PATCH] soc/tegra: fuse: fix bitwice vs. logical warning
@ 2021-11-17 14:21 Anders Roxell
2021-11-17 14:59 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: Anders Roxell @ 2021-11-17 14:21 UTC (permalink / raw)
To: thierry.reding, jonathanh
Cc: nathan, ndesaulniers, linux-tegra, linux-kernel, llvm, Anders Roxell
When building with clang-13 the compiler warns about:
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) |
^~~~~~~~~~~~~~~~~~~~~~~~~~
||
This should be a logical OR so change it to fix the warning.
Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
drivers/soc/tegra/fuse/speedo-tegra20.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/tegra/fuse/speedo-tegra20.c b/drivers/soc/tegra/fuse/speedo-tegra20.c
index 2546bddbab93..4984246605ae 100644
--- a/drivers/soc/tegra/fuse/speedo-tegra20.c
+++ b/drivers/soc/tegra/fuse/speedo-tegra20.c
@@ -69,7 +69,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info)
val = 0;
for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) {
- reg = tegra_fuse_read_spare(i) |
+ reg = tegra_fuse_read_spare(i) ||
tegra_fuse_read_spare(i + CPU_SPEEDO_REDUND_OFFS);
val = (val << 1) | (reg & 0x1);
}
@@ -84,7 +84,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info)
val = 0;
for (i = SOC_SPEEDO_MSBIT; i >= SOC_SPEEDO_LSBIT; i--) {
- reg = tegra_fuse_read_spare(i) |
+ reg = tegra_fuse_read_spare(i) ||
tegra_fuse_read_spare(i + SOC_SPEEDO_REDUND_OFFS);
val = (val << 1) | (reg & 0x1);
}
--
2.33.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc/tegra: fuse: fix bitwice vs. logical warning
2021-11-17 14:21 [PATCH] soc/tegra: fuse: fix bitwice vs. logical warning Anders Roxell
@ 2021-11-17 14:59 ` Nathan Chancellor
2021-11-17 15:38 ` Anders Roxell
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2021-11-17 14:59 UTC (permalink / raw)
To: Anders Roxell
Cc: thierry.reding, jonathanh, ndesaulniers, linux-tegra, linux-kernel, llvm
On Wed, Nov 17, 2021 at 03:21:15PM +0100, Anders Roxell wrote:
> When building with clang-13 the compiler warns about:
>
> 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) |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ||
>
> This should be a logical OR so change it to fix the warning.
>
> Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
I sent the same patch a couple of weeks ago (but it was right before the
merge window so I am sure nobody was really paying attention):
https://lore.kernel.org/r/20211021214500.2388146-1-nathan@kernel.org/
I do not particularly care which one gets merged (although I think mine
explains the warning a little bit better).
I am not sure your fixes tag is right, I would expect it to be:
Fixes: 25cd5a391478 ("ARM: tegra: Add speedo-based process identification")
With that fixed:
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/soc/tegra/fuse/speedo-tegra20.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/tegra/fuse/speedo-tegra20.c b/drivers/soc/tegra/fuse/speedo-tegra20.c
> index 2546bddbab93..4984246605ae 100644
> --- a/drivers/soc/tegra/fuse/speedo-tegra20.c
> +++ b/drivers/soc/tegra/fuse/speedo-tegra20.c
> @@ -69,7 +69,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info)
>
> val = 0;
> for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) {
> - reg = tegra_fuse_read_spare(i) |
> + reg = tegra_fuse_read_spare(i) ||
> tegra_fuse_read_spare(i + CPU_SPEEDO_REDUND_OFFS);
> val = (val << 1) | (reg & 0x1);
> }
> @@ -84,7 +84,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info)
>
> val = 0;
> for (i = SOC_SPEEDO_MSBIT; i >= SOC_SPEEDO_LSBIT; i--) {
> - reg = tegra_fuse_read_spare(i) |
> + reg = tegra_fuse_read_spare(i) ||
> tegra_fuse_read_spare(i + SOC_SPEEDO_REDUND_OFFS);
> val = (val << 1) | (reg & 0x1);
> }
> --
> 2.33.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc/tegra: fuse: fix bitwice vs. logical warning
2021-11-17 14:59 ` Nathan Chancellor
@ 2021-11-17 15:38 ` Anders Roxell
0 siblings, 0 replies; 3+ messages in thread
From: Anders Roxell @ 2021-11-17 15:38 UTC (permalink / raw)
To: Nathan Chancellor
Cc: thierry.reding, jonathanh, ndesaulniers, linux-tegra, linux-kernel, llvm
On Wed, 17 Nov 2021 at 16:00, Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Wed, Nov 17, 2021 at 03:21:15PM +0100, Anders Roxell wrote:
> > When building with clang-13 the compiler warns about:
> >
> > 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) |
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~
> > ||
> >
> > This should be a logical OR so change it to fix the warning.
> >
> > Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
> > Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>
> I sent the same patch a couple of weeks ago (but it was right before the
> merge window so I am sure nobody was really paying attention):
>
> https://lore.kernel.org/r/20211021214500.2388146-1-nathan@kernel.org/
>
> I do not particularly care which one gets merged (although I think mine
> explains the warning a little bit better).
I missed that, sorry.
I agree I think your changlog explains the warning better.
Cheers,
Anders
>
> I am not sure your fixes tag is right, I would expect it to be:
>
> Fixes: 25cd5a391478 ("ARM: tegra: Add speedo-based process identification")
>
> With that fixed:
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> > ---
> > drivers/soc/tegra/fuse/speedo-tegra20.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/soc/tegra/fuse/speedo-tegra20.c b/drivers/soc/tegra/fuse/speedo-tegra20.c
> > index 2546bddbab93..4984246605ae 100644
> > --- a/drivers/soc/tegra/fuse/speedo-tegra20.c
> > +++ b/drivers/soc/tegra/fuse/speedo-tegra20.c
> > @@ -69,7 +69,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info)
> >
> > val = 0;
> > for (i = CPU_SPEEDO_MSBIT; i >= CPU_SPEEDO_LSBIT; i--) {
> > - reg = tegra_fuse_read_spare(i) |
> > + reg = tegra_fuse_read_spare(i) ||
> > tegra_fuse_read_spare(i + CPU_SPEEDO_REDUND_OFFS);
> > val = (val << 1) | (reg & 0x1);
> > }
> > @@ -84,7 +84,7 @@ void __init tegra20_init_speedo_data(struct tegra_sku_info *sku_info)
> >
> > val = 0;
> > for (i = SOC_SPEEDO_MSBIT; i >= SOC_SPEEDO_LSBIT; i--) {
> > - reg = tegra_fuse_read_spare(i) |
> > + reg = tegra_fuse_read_spare(i) ||
> > tegra_fuse_read_spare(i + SOC_SPEEDO_REDUND_OFFS);
> > val = (val << 1) | (reg & 0x1);
> > }
> > --
> > 2.33.0
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-17 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 14:21 [PATCH] soc/tegra: fuse: fix bitwice vs. logical warning Anders Roxell
2021-11-17 14:59 ` Nathan Chancellor
2021-11-17 15:38 ` Anders Roxell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.