* [PATCH] ARM: iop13xx: Simplify iop13xx_atu{e,x}_pci_status checks
@ 2019-06-18 2:03 Nathan Chancellor
2019-06-24 20:13 ` [PATCH] ARM: iop13xx: Simplify iop13xx_atu{e, x}_pci_status checks Nick Desaulniers
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2019-06-18 2:03 UTC (permalink / raw)
To: Russell King
Cc: clang-built-linux, Nathan Chancellor, Nick Desaulniers,
linux-kernel, linux-arm-kernel
clang warns:
arch/arm/mach-iop13xx/pci.c:292:7: warning: logical not is only applied
to the left hand side of this comparison [-Wlogical-not-parentheses]
if (!iop13xx_atux_pci_status(1) == 0)
^ ~~
arch/arm/mach-iop13xx/pci.c:439:7: warning: logical not is only applied
to the left hand side of this comparison [-Wlogical-not-parentheses]
if (!iop13xx_atue_pci_status(1) == 0)
^ ~~
!func() == 0 is equivalent to func(), which clears up this warning and
makes the code more readable.
Link: https://github.com/ClangBuiltLinux/linux/issues/543
Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
arch/arm/mach-iop13xx/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 46ea06e906cc..94d30bc7bba1 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -289,7 +289,7 @@ iop13xx_atux_write_config(struct pci_bus *bus, unsigned int devfn, int where,
if (size != 4) {
val = iop13xx_atux_read(addr);
- if (!iop13xx_atux_pci_status(1) == 0)
+ if (iop13xx_atux_pci_status(1))
return PCIBIOS_SUCCESSFUL;
where = (where & 3) * 8;
@@ -436,7 +436,7 @@ iop13xx_atue_write_config(struct pci_bus *bus, unsigned int devfn, int where,
if (size != 4) {
val = iop13xx_atue_read(addr);
- if (!iop13xx_atue_pci_status(1) == 0)
+ if (iop13xx_atue_pci_status(1))
return PCIBIOS_SUCCESSFUL;
where = (where & 3) * 8;
--
2.22.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: iop13xx: Simplify iop13xx_atu{e, x}_pci_status checks
2019-06-18 2:03 [PATCH] ARM: iop13xx: Simplify iop13xx_atu{e,x}_pci_status checks Nathan Chancellor
@ 2019-06-24 20:13 ` Nick Desaulniers
0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2019-06-24 20:13 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: clang-built-linux, Russell King, Linux ARM, LKML
On Mon, Jun 17, 2019 at 7:03 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> clang warns:
>
> arch/arm/mach-iop13xx/pci.c:292:7: warning: logical not is only applied
> to the left hand side of this comparison [-Wlogical-not-parentheses]
> if (!iop13xx_atux_pci_status(1) == 0)
> ^ ~~
> arch/arm/mach-iop13xx/pci.c:439:7: warning: logical not is only applied
> to the left hand side of this comparison [-Wlogical-not-parentheses]
> if (!iop13xx_atue_pci_status(1) == 0)
> ^ ~~
>
> !func() == 0 is equivalent to func(), which clears up this warning and
> makes the code more readable.
Yep, this is more concise, thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
please submit this to:
https://www.armlinux.org.uk/developer/patches/add.php
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/543
> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> arch/arm/mach-iop13xx/pci.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
> index 46ea06e906cc..94d30bc7bba1 100644
> --- a/arch/arm/mach-iop13xx/pci.c
> +++ b/arch/arm/mach-iop13xx/pci.c
> @@ -289,7 +289,7 @@ iop13xx_atux_write_config(struct pci_bus *bus, unsigned int devfn, int where,
>
> if (size != 4) {
> val = iop13xx_atux_read(addr);
> - if (!iop13xx_atux_pci_status(1) == 0)
> + if (iop13xx_atux_pci_status(1))
> return PCIBIOS_SUCCESSFUL;
>
> where = (where & 3) * 8;
> @@ -436,7 +436,7 @@ iop13xx_atue_write_config(struct pci_bus *bus, unsigned int devfn, int where,
>
> if (size != 4) {
> val = iop13xx_atue_read(addr);
> - if (!iop13xx_atue_pci_status(1) == 0)
> + if (iop13xx_atue_pci_status(1))
> return PCIBIOS_SUCCESSFUL;
>
> where = (where & 3) * 8;
> --
> 2.22.0
>
--
Thanks,
~Nick Desaulniers
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-24 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 2:03 [PATCH] ARM: iop13xx: Simplify iop13xx_atu{e,x}_pci_status checks Nathan Chancellor
2019-06-24 20:13 ` [PATCH] ARM: iop13xx: Simplify iop13xx_atu{e, x}_pci_status checks Nick Desaulniers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).