Skip to content

Commit 3b3ccf9

Browse files
Yue Haibingkuba-moo
authored andcommitted
net: Remove unnecessary NULL check for lwtunnel_fill_encap()
lwtunnel_fill_encap() has NULL check and return 0, so no need to check before call it. Signed-off-by: Yue Haibing <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2855e43 commit 3b3ccf9

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

net/ipv4/fib_semantics.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,7 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
16401640
nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex))
16411641
goto nla_put_failure;
16421642

1643-
if (nhc->nhc_lwtstate &&
1644-
lwtunnel_fill_encap(skb, nhc->nhc_lwtstate,
1643+
if (lwtunnel_fill_encap(skb, nhc->nhc_lwtstate,
16451644
RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
16461645
goto nla_put_failure;
16471646

net/ipv4/nexthop.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,7 @@ static int nh_fill_node(struct sk_buff *skb, struct nexthop *nh,
985985
break;
986986
}
987987

988-
if (nhi->fib_nhc.nhc_lwtstate &&
989-
lwtunnel_fill_encap(skb, nhi->fib_nhc.nhc_lwtstate,
988+
if (lwtunnel_fill_encap(skb, nhi->fib_nhc.nhc_lwtstate,
990989
NHA_ENCAP, NHA_ENCAP_TYPE) < 0)
991990
goto nla_put_failure;
992991

net/ipv4/route.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,8 +2978,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
29782978
if (rt->dst.dev &&
29792979
nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
29802980
goto nla_put_failure;
2981-
if (rt->dst.lwtstate &&
2982-
lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
2981+
if (lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
29832982
goto nla_put_failure;
29842983
#ifdef CONFIG_IP_ROUTE_CLASSID
29852984
if (rt->dst.tclassid &&

net/ipv6/route.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5852,8 +5852,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
58525852
if (dst->dev && nla_put_u32(skb, RTA_OIF, dst->dev->ifindex))
58535853
goto nla_put_failure;
58545854

5855-
if (dst->lwtstate &&
5856-
lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
5855+
if (lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
58575856
goto nla_put_failure;
58585857
} else if (rt->fib6_nsiblings) {
58595858
struct fib6_info *sibling;

0 commit comments

Comments
 (0)