Skip to contentSkip to conversation

net: ethernet: mlx4: Remove unnecessary parentheses

PATCH Applied Varsha Rao 3 participants 3 messages Jun 1, 2018 – Jun 4, 2018

Subsystems (4)
lore
Share & tools
lore

Varsha Rao

author
#0 lore raw

PATCH 1/1 net: ethernet: mlx4: Remove unnecessary parentheses

This patch fixes the clang warning of extraneous parentheses, with the following coccinelle script.

@@
identifier i;
expression e;
statement s;
@@
if (
-(i == e)
+i == e
)
s

---
 drivers/net/ethernet/mellanox/mlx4/port.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/port.c +2 -2
index 3ef3406ff4cb..10fcc22f4590 100644
@@ -614,9 +614,9 @@ int __mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan,
 		int index_at_dup_port = -1;
 
 		for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
-			if ((vlan == (MLX4_VLAN_MASK & be32_to_cpu(table->entries[i]))))
+			if (vlan == (MLX4_VLAN_MASK & be32_to_cpu(table->entries[i])))
 				index_at_port = i;
-			if ((vlan == (MLX4_VLAN_MASK & be32_to_cpu(dup_table->entries[i]))))
+			if (vlan == (MLX4_VLAN_MASK & be32_to_cpu(dup_table->entries[i])))
 				index_at_dup_port = i;
 		}
 		/* check that same vlan is not in the tables at different indices */
Signature · 1 line
2.17.0
Acked-by on v1 1/1
#1 lore raw
Quoted 27 lines · Varsha Rao

This patch fixes the clang warning of extraneous parentheses, with the following coccinelle script.

@@
identifier i;
expression e;
statement s;
@@
if (

(quoted diff) +1 -1
-(i == e)
+i == e
  )

s

---
  drivers/net/ethernet/mellanox/mlx4/port.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/port.c +0 -0
index 3ef3406ff4cb..10fcc22f4590 100644
@@ -614,9 +614,9 @@ int __mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan,
  		int index_at_dup_port = -1;

drivers/net/ethernet/mellanox/mlx4/port.c int __mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, · line 622

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx4/port.c +2 -2
 
  		for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
-			if ((vlan == (MLX4_VLAN_MASK & be32_to_cpu(table->entries[i]))))
+			if (vlan == (MLX4_VLAN_MASK & be32_to_cpu(table->entries[i])))
  				index_at_port = i;
-			if ((vlan == (MLX4_VLAN_MASK & be32_to_cpu(dup_table->entries[i]))))
+			if (vlan == (MLX4_VLAN_MASK & be32_to_cpu(dup_table->entries[i])))
  				index_at_dup_port = i;
  		}
  		/* check that same vlan is not in the tables at different indices */

Thanks for your patch,
Tariq