diff mbox series

[net-next] net: remove redundant check in ip_metrics_convert()

Message ID 20221104022513.168868-1-shaozhengchao@huawei.com (mailing list archive)
State Accepted
Commit 552acbf576fb7cb7ec70e978ca148dfbdae12a0e
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: remove redundant check in ip_metrics_convert() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 5 this patch: 5
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shaozhengchao Nov. 4, 2022, 2:25 a.m. UTC
Now ip_metrics_convert() is only called by ip_fib_metrics_init(). Before
ip_fib_metrics_init() invokes ip_metrics_convert(), it checks whether
input parameter fc_mx is NULL. Therefore, ip_metrics_convert() doesn't
need to check fc_mx.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 net/ipv4/metrics.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

David Ahern Nov. 4, 2022, 3:15 a.m. UTC | #1
On 11/3/22 8:25 PM, Zhengchao Shao wrote:
> Now ip_metrics_convert() is only called by ip_fib_metrics_init(). Before
> ip_fib_metrics_init() invokes ip_metrics_convert(), it checks whether
> input parameter fc_mx is NULL. Therefore, ip_metrics_convert() doesn't
> need to check fc_mx.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>  net/ipv4/metrics.c | 3 ---
>  1 file changed, 3 deletions(-)
> 


Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Nov. 5, 2022, 2:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 4 Nov 2022 10:25:13 +0800 you wrote:
> Now ip_metrics_convert() is only called by ip_fib_metrics_init(). Before
> ip_fib_metrics_init() invokes ip_metrics_convert(), it checks whether
> input parameter fc_mx is NULL. Therefore, ip_metrics_convert() doesn't
> need to check fc_mx.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net-next] net: remove redundant check in ip_metrics_convert()
    https://git.kernel.org/netdev/net-next/c/552acbf576fb

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ipv4/metrics.c b/net/ipv4/metrics.c
index 25ea6ac44db9..7fcfdfd8f9de 100644
--- a/net/ipv4/metrics.c
+++ b/net/ipv4/metrics.c
@@ -14,9 +14,6 @@  static int ip_metrics_convert(struct net *net, struct nlattr *fc_mx,
 	struct nlattr *nla;
 	int remaining;
 
-	if (!fc_mx)
-		return 0;
-
 	nla_for_each_attr(nla, fc_mx, fc_mx_len, remaining) {
 		int type = nla_type(nla);
 		u32 val;