]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ipv4: delete redundant judgment statements
authorLi Zetao <lizetao1@huawei.com>
Thu, 22 Aug 2024 04:32:47 +0000 (12:32 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Aug 2024 13:27:45 +0000 (14:27 +0100)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/devinet.c
net/ipv4/fib_semantics.c

index 61be85154dd19d4a067ad96ed025150e33a1b363..ab76744383cf3827a7b1d8118bb22879adc7f9a2 100644 (file)
@@ -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] = {
index 0f70341cb8b5e3b0bc1ea5b5dca81a11cdca64b9..ba2df3d2ac15cffb95dedddf40103a865c909363 100644 (file)
@@ -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,