net: remove redundant check in ip_metrics_convert()
authorZhengchao Shao <shaozhengchao@huawei.com>
Fri, 4 Nov 2022 02:25:13 +0000 (10:25 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 5 Nov 2022 02:28:06 +0000 (19:28 -0700)
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>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20221104022513.168868-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/metrics.c

index 25ea6ac..7fcfdfd 100644 (file)
@@ -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;