diff options
| author | Ido Schimmel <idosch@nvidia.com> | 2026-03-26 23:32:31 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-03-28 07:07:24 +0300 |
| commit | ae3cdfd4e0b86e5d23b46b80e8b010f5392c9635 (patch) | |
| tree | bc1f4a68fded6f40cf6468635896e4bc7a93458b | |
| parent | 77a347f82a8043c2ee77edf50cb585fb7b604325 (diff) | |
| download | linux-ae3cdfd4e0b86e5d23b46b80e8b010f5392c9635.tar.xz | |
vrf: Remove unnecessary NULL check
The VRF driver always allocates an IPv4 dst entry for a VRF device and
prevents the device from being registered if the allocation fails.
Therefore, there is no need to check if the entry exists when tearing
down a VRF device. Remove the check.
Note that the same is not true for the IPv6 dst entry. Its creation can
be skipped if IPv6 is administratively disabled (i.e.,
'ipv6.disable=1').
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260326203233.1128554-2-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
| -rw-r--r-- | drivers/net/vrf.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c index 8c009bcaa8e7..0952ab6a2571 100644 --- a/drivers/net/vrf.c +++ b/drivers/net/vrf.c @@ -1007,13 +1007,11 @@ static void vrf_rtable_release(struct net_device *dev, struct net_vrf *vrf) /* move dev in dst's to loopback so this VRF device can be deleted * - based on dst_ifdown */ - if (rth) { - dst = &rth->dst; - netdev_ref_replace(dst->dev, net->loopback_dev, - &dst->dev_tracker, GFP_KERNEL); - dst->dev = net->loopback_dev; - dst_release(dst); - } + dst = &rth->dst; + netdev_ref_replace(dst->dev, net->loopback_dev, + &dst->dev_tracker, GFP_KERNEL); + dst->dev = net->loopback_dev; + dst_release(dst); } static int vrf_rtable_create(struct net_device *dev) |
