All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0
@ 2021-01-05 20:15 Nathan Chancellor
  2021-01-07 16:26 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2021-01-05 20:15 UTC (permalink / raw)
  To: John Crispin, Thomas Bogendoerfer
  Cc: Nick Desaulniers, linux-mips, linux-kernel, clang-built-linux,
	Nathan Chancellor, Dmitry Golovin

When building xway_defconfig with clang:

arch/mips/lantiq/irq.c:305:48: error: use of logical '&&' with constant
operand [-Werror,-Wconstant-logical-operand]
        if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
                                                      ^ ~~~~~~~~~~~~~~~~~
arch/mips/lantiq/irq.c:305:48: note: use '&' for a bitwise operation
        if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
                                                      ^~
                                                      &
arch/mips/lantiq/irq.c:305:48: note: remove constant to silence this
warning
        if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
                                                     ~^~~~~~~~~~~~~~~~~~~~
1 error generated.

Explicitly compare the constant LTQ_EBU_PCC_ISTAT against 0 to fix the
warning. Additionally, remove the unnecessary parentheses as this is a
simple conditional statement and shorthand '== 0' to '!'.

Fixes: 3645da0276ae ("OF: MIPS: lantiq: implement irq_domain support")
Link: https://github.com/ClangBuiltLinux/linux/issues/807
Reported-by: Dmitry Golovin <dima@golovin.in>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 arch/mips/lantiq/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index df8eed3875f6..43c2f271e6ab 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -302,7 +302,7 @@ static void ltq_hw_irq_handler(struct irq_desc *desc)
 	generic_handle_irq(irq_linear_revmap(ltq_domain, hwirq));
 
 	/* if this is a EBU irq, we need to ack it or get a deadlock */
-	if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
+	if (irq == LTQ_ICU_EBU_IRQ && !module && LTQ_EBU_PCC_ISTAT != 0)
 		ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_ISTAT) | 0x10,
 			LTQ_EBU_PCC_ISTAT);
 }

base-commit: 36bbbd0e234d817938bdc52121a0f5473b3e58f5
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0
  2021-01-05 20:15 [PATCH] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0 Nathan Chancellor
@ 2021-01-07 16:26 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-01-07 16:26 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: John Crispin, Nick Desaulniers, linux-mips, linux-kernel,
	clang-built-linux, Dmitry Golovin

On Tue, Jan 05, 2021 at 01:15:48PM -0700, Nathan Chancellor wrote:
> When building xway_defconfig with clang:
> 
> arch/mips/lantiq/irq.c:305:48: error: use of logical '&&' with constant
> operand [-Werror,-Wconstant-logical-operand]
>         if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
>                                                       ^ ~~~~~~~~~~~~~~~~~
> arch/mips/lantiq/irq.c:305:48: note: use '&' for a bitwise operation
>         if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
>                                                       ^~
>                                                       &
> arch/mips/lantiq/irq.c:305:48: note: remove constant to silence this
> warning
>         if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
>                                                      ~^~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> 
> Explicitly compare the constant LTQ_EBU_PCC_ISTAT against 0 to fix the
> warning. Additionally, remove the unnecessary parentheses as this is a
> simple conditional statement and shorthand '== 0' to '!'.
> 
> Fixes: 3645da0276ae ("OF: MIPS: lantiq: implement irq_domain support")
> Link: https://github.com/ClangBuiltLinux/linux/issues/807
> Reported-by: Dmitry Golovin <dima@golovin.in>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  arch/mips/lantiq/irq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-07 16:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 20:15 [PATCH] MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0 Nathan Chancellor
2021-01-07 16:26 ` Thomas Bogendoerfer

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.