You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.8 KiB
123 lines
3.8 KiB
4 years ago
|
From 729bd53ed3a4df05c1593a5aba2d60dfd4390b43 Mon Sep 17 00:00:00 2001
|
||
|
From: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Date: Sun, 10 May 2020 15:04:36 -0400
|
||
|
Subject: [PATCH 112/312] [netdrv] net/mlx5e: Remove redundant pointer check
|
||
|
|
||
|
Message-id: <20200510150452.10307-72-ahleihel@redhat.com>
|
||
|
Patchwork-id: 306695
|
||
|
Patchwork-instance: patchwork
|
||
|
O-Subject: [RHEL8.3 BZ 1789380 v2 71/87] net/mlx5e: Remove redundant pointer check
|
||
|
Bugzilla: 1789380
|
||
|
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
||
|
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
||
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
||
|
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
|
||
|
|
||
|
Bugzilla: http://bugzilla.redhat.com/1789380
|
||
|
Upstream: v5.5-rc1
|
||
|
|
||
|
commit 90ac245814abc30d2423474310654d31e3908b2f
|
||
|
Author: Eli Cohen <eli@mellanox.com>
|
||
|
Date: Thu Oct 31 09:12:18 2019 +0200
|
||
|
|
||
|
net/mlx5e: Remove redundant pointer check
|
||
|
|
||
|
When code reaches the "out" label, n is guaranteed to be valid so we can
|
||
|
unconditionally call neigh_release.
|
||
|
|
||
|
Also change the label to release_neigh to better reflect the fact that
|
||
|
we unconditionally free the neighbour and also match other labels
|
||
|
convention.
|
||
|
|
||
|
Signed-off-by: Eli Cohen <eli@mellanox.com>
|
||
|
Reviewed-by: Roi Dayan <roid@mellanox.com>
|
||
|
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
||
|
|
||
|
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
||
|
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
||
|
---
|
||
|
.../net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 22 ++++++++++------------
|
||
|
1 file changed, 10 insertions(+), 12 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
|
||
|
index 8a9791473f57..edcbcc3d3223 100644
|
||
|
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
|
||
|
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
|
||
|
@@ -236,13 +236,13 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
|
||
|
mlx5_core_warn(priv->mdev, "encap size %d too big, max supported is %d\n",
|
||
|
ipv4_encap_size, max_encap_size);
|
||
|
err = -EOPNOTSUPP;
|
||
|
- goto out;
|
||
|
+ goto release_neigh;
|
||
|
}
|
||
|
|
||
|
encap_header = kzalloc(ipv4_encap_size, GFP_KERNEL);
|
||
|
if (!encap_header) {
|
||
|
err = -ENOMEM;
|
||
|
- goto out;
|
||
|
+ goto release_neigh;
|
||
|
}
|
||
|
|
||
|
/* used by mlx5e_detach_encap to lookup a neigh hash table
|
||
|
@@ -294,7 +294,7 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
|
||
|
/* the encap entry will be made valid on neigh update event
|
||
|
* and not used before that.
|
||
|
*/
|
||
|
- goto out;
|
||
|
+ goto release_neigh;
|
||
|
}
|
||
|
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
|
||
|
e->reformat_type,
|
||
|
@@ -314,9 +314,8 @@ int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
|
||
|
mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
|
||
|
free_encap:
|
||
|
kfree(encap_header);
|
||
|
-out:
|
||
|
- if (n)
|
||
|
- neigh_release(n);
|
||
|
+release_neigh:
|
||
|
+ neigh_release(n);
|
||
|
return err;
|
||
|
}
|
||
|
|
||
|
@@ -355,13 +354,13 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
|
||
|
mlx5_core_warn(priv->mdev, "encap size %d too big, max supported is %d\n",
|
||
|
ipv6_encap_size, max_encap_size);
|
||
|
err = -EOPNOTSUPP;
|
||
|
- goto out;
|
||
|
+ goto release_neigh;
|
||
|
}
|
||
|
|
||
|
encap_header = kzalloc(ipv6_encap_size, GFP_KERNEL);
|
||
|
if (!encap_header) {
|
||
|
err = -ENOMEM;
|
||
|
- goto out;
|
||
|
+ goto release_neigh;
|
||
|
}
|
||
|
|
||
|
/* used by mlx5e_detach_encap to lookup a neigh hash table
|
||
|
@@ -412,7 +411,7 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
|
||
|
/* the encap entry will be made valid on neigh update event
|
||
|
* and not used before that.
|
||
|
*/
|
||
|
- goto out;
|
||
|
+ goto release_neigh;
|
||
|
}
|
||
|
|
||
|
e->pkt_reformat = mlx5_packet_reformat_alloc(priv->mdev,
|
||
|
@@ -433,9 +432,8 @@ int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
|
||
|
mlx5e_rep_encap_entry_detach(netdev_priv(e->out_dev), e);
|
||
|
free_encap:
|
||
|
kfree(encap_header);
|
||
|
-out:
|
||
|
- if (n)
|
||
|
- neigh_release(n);
|
||
|
+release_neigh:
|
||
|
+ neigh_release(n);
|
||
|
return err;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.13.6
|
||
|
|