Message ID | 20240822043252.3488749-7-lizetao1@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | ebe39f95bc8138eedaba9adaa5a4d7bfe98a9806 |
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/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)
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(-)