From: Li Zetao Date: Thu, 22 Aug 2024 04:32:44 +0000 (+0800) Subject: fib: rules: delete redundant judgment statements X-Git-Tag: v6.12-rc1~232^2~195^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41aa426392be26865a8a774df3e5ec4c56a98b26;p=thirdparty%2Fkernel%2Flinux.git fib: rules: delete redundant judgment statements 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 Reviewed-by: Petr Machata Signed-off-by: David S. Miller --- diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 6ebffbc632368..3c76b835493da 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)