linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap()
@ 2025-06-24 14:00 Yue Haibing
  2025-06-24 18:28 ` Kuniyuki Iwashima
  2025-06-26  0:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yue Haibing @ 2025-06-24 14:00 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, horms, kuniyu
  Cc: netdev, linux-kernel, yuehaibing

lwtunnel_fill_encap() has NULL check and return 0, so no need
to check before call it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
 net/ipv4/fib_semantics.c | 3 +--
 net/ipv4/nexthop.c       | 3 +--
 net/ipv4/route.c         | 3 +--
 net/ipv6/route.c         | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 2b60e0b010e1..475ffcbf4927 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1632,8 +1632,7 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
 	    nla_put_u32(skb, RTA_OIF, nhc->nhc_dev->ifindex))
 		goto nla_put_failure;
 
-	if (nhc->nhc_lwtstate &&
-	    lwtunnel_fill_encap(skb, nhc->nhc_lwtstate,
+	if (lwtunnel_fill_encap(skb, nhc->nhc_lwtstate,
 				RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
 		goto nla_put_failure;
 
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 4397e89d3123..e808801ab9b8 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -985,8 +985,7 @@ static int nh_fill_node(struct sk_buff *skb, struct nexthop *nh,
 		break;
 	}
 
-	if (nhi->fib_nhc.nhc_lwtstate &&
-	    lwtunnel_fill_encap(skb, nhi->fib_nhc.nhc_lwtstate,
+	if (lwtunnel_fill_encap(skb, nhi->fib_nhc.nhc_lwtstate,
 				NHA_ENCAP, NHA_ENCAP_TYPE) < 0)
 		goto nla_put_failure;
 
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 3ddf6bf40357..1dc18decb4a8 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2977,8 +2977,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
 	if (rt->dst.dev &&
 	    nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
 		goto nla_put_failure;
-	if (rt->dst.lwtstate &&
-	    lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
+	if (lwtunnel_fill_encap(skb, rt->dst.lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
 		goto nla_put_failure;
 #ifdef CONFIG_IP_ROUTE_CLASSID
 	if (rt->dst.tclassid &&
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index df0caffefb38..477e3d4dab8b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5852,8 +5852,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
 		if (dst->dev && nla_put_u32(skb, RTA_OIF, dst->dev->ifindex))
 			goto nla_put_failure;
 
-		if (dst->lwtstate &&
-		    lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
+		if (lwtunnel_fill_encap(skb, dst->lwtstate, RTA_ENCAP, RTA_ENCAP_TYPE) < 0)
 			goto nla_put_failure;
 	} else if (rt->fib6_nsiblings) {
 		struct fib6_info *sibling;
-- 
2.34.1


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

* Re: [PATCH net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap()
  2025-06-24 14:00 [PATCH net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap() Yue Haibing
@ 2025-06-24 18:28 ` Kuniyuki Iwashima
  2025-06-26  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2025-06-24 18:28 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel

On Tue, Jun 24, 2025 at 6:42 AM Yue Haibing <yuehaibing@huawei.com> wrote:
>
> lwtunnel_fill_encap() has NULL check and return 0, so no need
> to check before call it.
>
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

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

* Re: [PATCH net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap()
  2025-06-24 14:00 [PATCH net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap() Yue Haibing
  2025-06-24 18:28 ` Kuniyuki Iwashima
@ 2025-06-26  0:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-26  0:50 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, kuniyu, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 24 Jun 2025 22:00:15 +0800 you wrote:
> lwtunnel_fill_encap() has NULL check and return 0, so no need
> to check before call it.
> 
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
>  net/ipv4/fib_semantics.c | 3 +--
>  net/ipv4/nexthop.c       | 3 +--
>  net/ipv4/route.c         | 3 +--
>  net/ipv6/route.c         | 3 +--
>  4 files changed, 4 insertions(+), 8 deletions(-)

Here is the summary with links:
  - [net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap()
    https://git.kernel.org/netdev/net-next/c/3b3ccf9ed05e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-06-26  0:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-24 14:00 [PATCH net-next] net: Remove unnecessary NULL check for lwtunnel_fill_encap() Yue Haibing
2025-06-24 18:28 ` Kuniyuki Iwashima
2025-06-26  0:50 ` patchwork-bot+netdevbpf

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