mbox series

[net-next,00/10] net: Delete some redundant judgments

Message ID 20240822043252.3488749-1-lizetao1@huawei.com (mailing list archive)
Headers show
Series net: Delete some redundant judgments | expand

Message

lizetao Aug. 22, 2024, 4:32 a.m. UTC
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(-)

Comments

Petr Machata Aug. 23, 2024, 1:16 p.m. UTC | #1
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.
patchwork-bot+netdevbpf@kernel.org Aug. 23, 2024, 1:30 p.m. UTC | #2
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!
lizetao Aug. 24, 2024, 2:16 a.m. UTC | #3
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.