Message ID | 20240822043252.3488749-11-lizetao1@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | fb8e83cf443a98297cd15b58b5529f8d259b22f5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: Delete some redundant judgments | expand |
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>
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,
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(-)