linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bonding: Remove extraneous parentheses in bond_setup
@ 2020-06-26  4:10 Nathan Chancellor
  2020-06-26 18:03 ` Nick Desaulniers
  2020-06-26 19:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2020-06-26  4:10 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek, Jarod Wilson,
	netdev, linux-kernel, clang-built-linux, Nathan Chancellor

Clang warns:

drivers/net/bonding/bond_main.c:4657:23: warning: equality comparison
with extraneous parentheses [-Wparentheses-equality]
        if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

drivers/net/bonding/bond_main.c:4681:23: warning: equality comparison
with extraneous parentheses [-Wparentheses-equality]
        if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
             ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

This warning occurs when a comparision has two sets of parentheses,
which is usually the convention for doing an assignment within an
if statement. Since equality comparisons do not need a second set of
parentheses, remove them to fix the warning.

Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves")
Link: https://github.com/ClangBuiltLinux/linux/issues/1066
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/net/bonding/bond_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4ef99efc37f6..b3479584cc16 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4654,7 +4654,7 @@ void bond_setup(struct net_device *bond_dev)
 
 #ifdef CONFIG_XFRM_OFFLOAD
 	/* set up xfrm device ops (only supported in active-backup right now) */
-	if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
+	if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
 		bond_dev->xfrmdev_ops = &bond_xfrmdev_ops;
 	bond->xs = NULL;
 #endif /* CONFIG_XFRM_OFFLOAD */
@@ -4678,7 +4678,7 @@ void bond_setup(struct net_device *bond_dev)
 
 	bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
 #ifdef CONFIG_XFRM_OFFLOAD
-	if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
+	if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
 		bond_dev->hw_features |= BOND_XFRM_FEATURES;
 #endif /* CONFIG_XFRM_OFFLOAD */
 	bond_dev->features |= bond_dev->hw_features;

base-commit: 7bed14551659875e1cd23a7c0266394a29a773b3
-- 
2.27.0


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

* Re: [PATCH net-next] bonding: Remove extraneous parentheses in bond_setup
  2020-06-26  4:10 [PATCH net-next] bonding: Remove extraneous parentheses in bond_setup Nathan Chancellor
@ 2020-06-26 18:03 ` Nick Desaulniers
  2020-06-26 19:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2020-06-26 18:03 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: David S. Miller, Jakub Kicinski, Jay Vosburgh, Veaceslav Falico,
	Andy Gospodarek, Jarod Wilson, Network Development, LKML,
	clang-built-linux

On Thu, Jun 25, 2020 at 9:10 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns:
>
> drivers/net/bonding/bond_main.c:4657:23: warning: equality comparison
> with extraneous parentheses [-Wparentheses-equality]
>         if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
>              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/net/bonding/bond_main.c:4681:23: warning: equality comparison
> with extraneous parentheses [-Wparentheses-equality]
>         if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
>              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
>
> This warning occurs when a comparision has two sets of parentheses,
> which is usually the convention for doing an assignment within an
> if statement. Since equality comparisons do not need a second set of
> parentheses, remove them to fix the warning.
>
> Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1066
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks for the patch.  I recently saw this in a report from KernelCI
this morning.  Adding a tag to reward the robot.

Reported-by: kernelci.org bot <bot@kernelci.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  drivers/net/bonding/bond_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 4ef99efc37f6..b3479584cc16 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -4654,7 +4654,7 @@ void bond_setup(struct net_device *bond_dev)
>
>  #ifdef CONFIG_XFRM_OFFLOAD
>         /* set up xfrm device ops (only supported in active-backup right now) */
> -       if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
> +       if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
>                 bond_dev->xfrmdev_ops = &bond_xfrmdev_ops;
>         bond->xs = NULL;
>  #endif /* CONFIG_XFRM_OFFLOAD */
> @@ -4678,7 +4678,7 @@ void bond_setup(struct net_device *bond_dev)
>
>         bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
>  #ifdef CONFIG_XFRM_OFFLOAD
> -       if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
> +       if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP)
>                 bond_dev->hw_features |= BOND_XFRM_FEATURES;
>  #endif /* CONFIG_XFRM_OFFLOAD */
>         bond_dev->features |= bond_dev->hw_features;
>
> base-commit: 7bed14551659875e1cd23a7c0266394a29a773b3
> --

-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH net-next] bonding: Remove extraneous parentheses in bond_setup
  2020-06-26  4:10 [PATCH net-next] bonding: Remove extraneous parentheses in bond_setup Nathan Chancellor
  2020-06-26 18:03 ` Nick Desaulniers
@ 2020-06-26 19:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-06-26 19:19 UTC (permalink / raw)
  To: natechancellor
  Cc: kuba, j.vosburgh, vfalico, andy, jarod, netdev, linux-kernel,
	clang-built-linux

From: Nathan Chancellor <natechancellor@gmail.com>
Date: Thu, 25 Jun 2020 21:10:02 -0700

> Clang warns:
> 
> drivers/net/bonding/bond_main.c:4657:23: warning: equality comparison
> with extraneous parentheses [-Wparentheses-equality]
>         if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
>              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
> 
> drivers/net/bonding/bond_main.c:4681:23: warning: equality comparison
> with extraneous parentheses [-Wparentheses-equality]
>         if ((BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP))
>              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
> 
> This warning occurs when a comparision has two sets of parentheses,
> which is usually the convention for doing an assignment within an
> if statement. Since equality comparisons do not need a second set of
> parentheses, remove them to fix the warning.
> 
> Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1066
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Applied, thank you.

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

end of thread, other threads:[~2020-06-26 19:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26  4:10 [PATCH net-next] bonding: Remove extraneous parentheses in bond_setup Nathan Chancellor
2020-06-26 18:03 ` Nick Desaulniers
2020-06-26 19:19 ` David Miller

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).