* [PATCH net-next 00/10] net: Delete some redundant judgments
@ 2024-08-22 4:32 Li Zetao
2024-08-22 4:32 ` [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements Li Zetao
` (11 more replies)
0 siblings, 12 replies; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
This patchset aims to remove some unnecessary judgments and make the
code more concise. In some network modules, rtnl_set_sk_err is used to
record error information, but the err is repeatedly judged to be less
than 0 on the error path. Deleted these redundant judgments.
No functional change intended.
Li Zetao (10):
net: vxlan: delete redundant judgment statements
fib: rules: delete redundant judgment statements
neighbour: delete redundant judgment statements
rtnetlink: delete redundant judgment statements
ipv4: delete redundant judgment statements
ipmr: delete redundant judgment statements
net: nexthop: delete redundant judgment statements
ip6mr: delete redundant judgment statements
net/ipv6: delete redundant judgment statements
net: mpls: delete redundant judgment statements
drivers/net/vxlan/vxlan_core.c | 3 +--
net/core/fib_rules.c | 3 +--
net/core/neighbour.c | 3 +--
net/core/rtnetlink.c | 3 +--
net/ipv4/devinet.c | 6 ++----
net/ipv4/fib_semantics.c | 3 +--
net/ipv4/ipmr.c | 3 +--
net/ipv4/nexthop.c | 6 ++----
net/ipv6/ip6mr.c | 3 +--
net/ipv6/route.c | 6 ++----
net/mpls/af_mpls.c | 6 ++----
11 files changed, 15 insertions(+), 30 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:13 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 02/10] fib: rules: " Li Zetao
` (10 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
drivers/net/vxlan/vxlan_core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 8983e75e9881..34391c18bba7 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -277,8 +277,7 @@ static void __vxlan_fdb_notify(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,
rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
+ rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
}
static void vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan,
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 02/10] fib: rules: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
2024-08-22 4:32 ` [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:13 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 03/10] neighbour: " Li Zetao
` (9 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOMEM, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/core/fib_rules.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 6ebffbc63236..3c76b835493d 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -1205,8 +1205,7 @@ static void notify_rule_change(int event, struct fib_rule *rule,
rtnl_notify(skb, net, pid, ops->nlgroup, nlh, GFP_KERNEL);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, ops->nlgroup, err);
+ rtnl_set_sk_err(net, ops->nlgroup, err);
}
static void attach_rules(struct list_head *rules, struct net_device *dev)
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 03/10] neighbour: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
2024-08-22 4:32 ` [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements Li Zetao
2024-08-22 4:32 ` [PATCH net-next 02/10] fib: rules: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:14 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 04/10] rtnetlink: " Li Zetao
` (8 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/core/neighbour.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index a6fe88eca939..77b819cd995b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -3530,8 +3530,7 @@ static void __neigh_notify(struct neighbour *n, int type, int flags,
rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
+ rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
}
void neigh_app_ns(struct neighbour *n)
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 04/10] rtnetlink: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (2 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 03/10] neighbour: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:14 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 05/10] ipv4: " Li Zetao
` (7 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/core/rtnetlink.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 73fd7f543fd0..cd9487a12d1a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4087,8 +4087,7 @@ struct sk_buff *rtmsg_ifinfo_build_skb(int type, struct net_device *dev,
}
return skb;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_LINK, err);
+ rtnl_set_sk_err(net, RTNLGRP_LINK, err);
return NULL;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 05/10] ipv4: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (3 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 04/10] rtnetlink: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:14 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 06/10] ipmr: " Li Zetao
` (6 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/ipv4/devinet.c | 6 ++----
net/ipv4/fib_semantics.c | 3 +--
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 61be85154dd1..ab76744383cf 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1943,8 +1943,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,
rtnl_notify(skb, net, portid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err);
+ rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err);
}
static size_t inet_get_link_af_size(const struct net_device *dev,
@@ -2140,8 +2139,7 @@ void inet_netconf_notify_devconf(struct net *net, int event, int type,
rtnl_notify(skb, net, 0, RTNLGRP_IPV4_NETCONF, NULL, GFP_KERNEL);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_IPV4_NETCONF, err);
+ rtnl_set_sk_err(net, RTNLGRP_IPV4_NETCONF, err);
}
static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = {
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 0f70341cb8b5..ba2df3d2ac15 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -543,8 +543,7 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
info->nlh, GFP_KERNEL);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
+ rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
}
static int fib_detect_death(struct fib_info *fi, int order,
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 06/10] ipmr: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (4 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 05/10] ipv4: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:15 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 07/10] net: nexthop: " Li Zetao
` (5 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/ipv4/ipmr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 6c750bd13dd8..6e38bb0ef735 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2406,8 +2406,7 @@ static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc,
errout:
kfree_skb(skb);
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_IPV4_MROUTE, err);
+ rtnl_set_sk_err(net, RTNLGRP_IPV4_MROUTE, err);
}
static size_t igmpmsg_netlink_msgsize(size_t payloadlen)
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 07/10] net: nexthop: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (5 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 06/10] ipmr: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:15 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 08/10] ip6mr: " Li Zetao
` (4 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/ipv4/nexthop.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 9db10d409074..93aaea0006ba 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -1090,8 +1090,7 @@ static void nexthop_notify(int event, struct nexthop *nh, struct nl_info *info)
info->nlh, gfp_any());
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(info->nl_net, RTNLGRP_NEXTHOP, err);
+ rtnl_set_sk_err(info->nl_net, RTNLGRP_NEXTHOP, err);
}
static unsigned long nh_res_bucket_used_time(const struct nh_res_bucket *bucket)
@@ -1211,8 +1210,7 @@ static void nexthop_bucket_notify(struct nh_res_table *res_table,
rtnl_notify(skb, nh->net, 0, RTNLGRP_NEXTHOP, NULL, GFP_KERNEL);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(nh->net, RTNLGRP_NEXTHOP, err);
+ rtnl_set_sk_err(nh->net, RTNLGRP_NEXTHOP, err);
}
static bool valid_group_nh(struct nexthop *nh, unsigned int npaths,
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 08/10] ip6mr: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (6 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 07/10] net: nexthop: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:15 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 09/10] net/ipv6: " Li Zetao
` (3 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/ipv6/ip6mr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index dd342e6ecf3f..e3ee93c562c3 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -2431,8 +2431,7 @@ static void mr6_netlink_event(struct mr_table *mrt, struct mfc6_cache *mfc,
errout:
kfree_skb(skb);
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_IPV6_MROUTE, err);
+ rtnl_set_sk_err(net, RTNLGRP_IPV6_MROUTE, err);
}
static size_t mrt6msg_netlink_msgsize(size_t payloadlen)
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 09/10] net/ipv6: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (7 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 08/10] ip6mr: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:16 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 10/10] net: mpls: " Li Zetao
` (2 subsequent siblings)
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/ipv6/route.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 219701caba1e..7e7de29ad05f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -6193,8 +6193,7 @@ void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
info->nlh, gfp_any());
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
+ rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
}
void fib6_rt_update(struct net *net, struct fib6_info *rt,
@@ -6220,8 +6219,7 @@ void fib6_rt_update(struct net *net, struct fib6_info *rt,
info->nlh, gfp_any());
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
+ rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
}
void fib6_info_hw_flags_set(struct net *net, struct fib6_info *f6i,
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH net-next 10/10] net: mpls: delete redundant judgment statements
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (8 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 09/10] net/ipv6: " Li Zetao
@ 2024-08-22 4:32 ` Li Zetao
2024-08-23 13:16 ` Petr Machata
2024-08-23 13:16 ` [PATCH net-next 00/10] net: Delete some redundant judgments Petr Machata
2024-08-23 13:30 ` patchwork-bot+netdevbpf
11 siblings, 1 reply; 24+ messages in thread
From: Li Zetao @ 2024-08-22 4:32 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, lizetao1,
j.granados, linux, judyhsiao, jiri
Cc: netdev
The initial value of err is -ENOBUFS, and err is guaranteed to be
less than 0 before all goto errout. Therefore, on the error path
of errout, there is no need to repeatedly judge that err is less than 0,
and delete redundant judgments to make the code more concise.
Signed-off-by: Li Zetao <lizetao1@huawei.com>
---
net/mpls/af_mpls.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 0e6c94a8c2bc..aba983531ed3 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1201,8 +1201,7 @@ static void mpls_netconf_notify_devconf(struct net *net, int event,
rtnl_notify(skb, net, 0, RTNLGRP_MPLS_NETCONF, NULL, GFP_KERNEL);
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_MPLS_NETCONF, err);
+ rtnl_set_sk_err(net, RTNLGRP_MPLS_NETCONF, err);
}
static const struct nla_policy devconf_mpls_policy[NETCONFA_MAX + 1] = {
@@ -2278,8 +2277,7 @@ static void rtmsg_lfib(int event, u32 label, struct mpls_route *rt,
return;
errout:
- if (err < 0)
- rtnl_set_sk_err(net, RTNLGRP_MPLS_ROUTE, err);
+ rtnl_set_sk_err(net, RTNLGRP_MPLS_ROUTE, err);
}
static int mpls_valid_getroute_req(struct sk_buff *skb,
--
2.34.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements Li Zetao
@ 2024-08-23 13:13 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:13 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 02/10] fib: rules: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 02/10] fib: rules: " Li Zetao
@ 2024-08-23 13:13 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:13 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOMEM, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 03/10] neighbour: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 03/10] neighbour: " Li Zetao
@ 2024-08-23 13:14 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:14 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 04/10] rtnetlink: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 04/10] rtnetlink: " Li Zetao
@ 2024-08-23 13:14 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:14 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 05/10] ipv4: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 05/10] ipv4: " Li Zetao
@ 2024-08-23 13:14 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:14 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 06/10] ipmr: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 06/10] ipmr: " Li Zetao
@ 2024-08-23 13:15 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:15 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 07/10] net: nexthop: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 07/10] net: nexthop: " Li Zetao
@ 2024-08-23 13:15 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:15 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 08/10] ip6mr: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 08/10] ip6mr: " Li Zetao
@ 2024-08-23 13:15 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:15 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 09/10] net/ipv6: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 09/10] net/ipv6: " Li Zetao
@ 2024-08-23 13:16 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:16 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 10/10] net: mpls: delete redundant judgment statements
2024-08-22 4:32 ` [PATCH net-next 10/10] net: mpls: " Li Zetao
@ 2024-08-23 13:16 ` Petr Machata
0 siblings, 0 replies; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:16 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> The initial value of err is -ENOBUFS, and err is guaranteed to be
> less than 0 before all goto errout. Therefore, on the error path
> of errout, there is no need to repeatedly judge that err is less than 0,
> and delete redundant judgments to make the code more concise.
>
> Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 00/10] net: Delete some redundant judgments
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (9 preceding siblings ...)
2024-08-22 4:32 ` [PATCH net-next 10/10] net: mpls: " Li Zetao
@ 2024-08-23 13:16 ` Petr Machata
2024-08-24 2:16 ` Li Zetao
2024-08-23 13:30 ` patchwork-bot+netdevbpf
11 siblings, 1 reply; 24+ messages in thread
From: Petr Machata @ 2024-08-23 13:16 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Li Zetao <lizetao1@huawei.com> writes:
> This patchset aims to remove some unnecessary judgments and make the
> code more concise. In some network modules, rtnl_set_sk_err is used to
> record error information, but the err is repeatedly judged to be less
> than 0 on the error path. Deleted these redundant judgments.
What you call "judgments" would be usually called "conditionals" or
"conditional statements", "judged less than zero" would be probably
"compared to zero". I think the commit messages are reasonably clear
despite this, so I'd leave it be unless others push back. But it's worth
keeping in mind for future contributions.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH net-next 00/10] net: Delete some redundant judgments
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
` (10 preceding siblings ...)
2024-08-23 13:16 ` [PATCH net-next 00/10] net: Delete some redundant judgments Petr Machata
@ 2024-08-23 13:30 ` patchwork-bot+netdevbpf
11 siblings, 0 replies; 24+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-23 13:30 UTC (permalink / raw)
To: Li Zetao
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, petrm,
gnault, b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Hello:
This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 22 Aug 2024 12:32:42 +0800 you wrote:
> This patchset aims to remove some unnecessary judgments and make the
> code more concise. In some network modules, rtnl_set_sk_err is used to
> record error information, but the err is repeatedly judged to be less
> than 0 on the error path. Deleted these redundant judgments.
>
> No functional change intended.
>
> [...]
Here is the summary with links:
- [net-next,01/10] net: vxlan: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/6ef1ca2d14f2
- [net-next,02/10] fib: rules: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/41aa426392be
- [net-next,03/10] neighbour: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/c25bdd2ac8cf
- [net-next,04/10] rtnetlink: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/2d522384fb5b
- [net-next,05/10] ipv4: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/4c180887775f
- [net-next,06/10] ipmr: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/ebe39f95bc81
- [net-next,07/10] net: nexthop: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/649c3c9b8e44
- [net-next,08/10] ip6mr: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/aa32799c017b
- [net-next,09/10] net/ipv6: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/cd9ebde125bf
- [net-next,10/10] net: mpls: delete redundant judgment statements
https://git.kernel.org/netdev/net-next/c/fb8e83cf443a
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] 24+ messages in thread
* Re: [PATCH net-next 00/10] net: Delete some redundant judgments
2024-08-23 13:16 ` [PATCH net-next 00/10] net: Delete some redundant judgments Petr Machata
@ 2024-08-24 2:16 ` Li Zetao
0 siblings, 0 replies; 24+ messages in thread
From: Li Zetao @ 2024-08-24 2:16 UTC (permalink / raw)
To: Petr Machata
Cc: davem, edumazet, kuba, pabeni, dsahern, idosch, amcohen, gnault,
b.galvani, alce, shaozhengchao, horms, j.granados, linux,
judyhsiao, jiri, netdev
Hi,
在 2024/8/23 21:16, Petr Machata 写道:
>
> Li Zetao <lizetao1@huawei.com> writes:
>
>> This patchset aims to remove some unnecessary judgments and make the
>> code more concise. In some network modules, rtnl_set_sk_err is used to
>> record error information, but the err is repeatedly judged to be less
>> than 0 on the error path. Deleted these redundant judgments.
>
> What you call "judgments" would be usually called "conditionals" or
> "conditional statements", "judged less than zero" would be probably
> "compared to zero". I think the commit messages are reasonably clear
> despite this, so I'd leave it be unless others push back. But it's worth
> keeping in mind for future contributions.
Thanks you, I will take your advice.
Thanks,
Li Zetao.
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2024-08-24 2:16 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 4:32 [PATCH net-next 00/10] net: Delete some redundant judgments Li Zetao
2024-08-22 4:32 ` [PATCH net-next 01/10] net: vxlan: delete redundant judgment statements Li Zetao
2024-08-23 13:13 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 02/10] fib: rules: " Li Zetao
2024-08-23 13:13 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 03/10] neighbour: " Li Zetao
2024-08-23 13:14 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 04/10] rtnetlink: " Li Zetao
2024-08-23 13:14 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 05/10] ipv4: " Li Zetao
2024-08-23 13:14 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 06/10] ipmr: " Li Zetao
2024-08-23 13:15 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 07/10] net: nexthop: " Li Zetao
2024-08-23 13:15 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 08/10] ip6mr: " Li Zetao
2024-08-23 13:15 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 09/10] net/ipv6: " Li Zetao
2024-08-23 13:16 ` Petr Machata
2024-08-22 4:32 ` [PATCH net-next 10/10] net: mpls: " Li Zetao
2024-08-23 13:16 ` Petr Machata
2024-08-23 13:16 ` [PATCH net-next 00/10] net: Delete some redundant judgments Petr Machata
2024-08-24 2:16 ` Li Zetao
2024-08-23 13:30 ` 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).