SUNRPC: use max_t() to simplify open code
authorZiyang Xuan <william.xuanziyang@huawei.com>
Tue, 7 Jun 2022 07:32:01 +0000 (15:32 +0800)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 3 Oct 2022 15:26:36 +0000 (11:26 -0400)
Use max_t() to simplify open code which uses "if...else" to get maximum of
two values.

Generated by coccinelle script:
scripts/coccinelle/misc/minmax.cocci

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprt.c

index a50feba..71dc263 100644 (file)
@@ -1822,10 +1822,7 @@ struct rpc_xprt *xprt_alloc(struct net *net, size_t size,
                        goto out_free;
                list_add(&req->rq_list, &xprt->free);
        }
-       if (max_alloc > num_prealloc)
-               xprt->max_reqs = max_alloc;
-       else
-               xprt->max_reqs = num_prealloc;
+       xprt->max_reqs = max_t(unsigned int, max_alloc, num_prealloc);
        xprt->min_reqs = num_prealloc;
        xprt->num_reqs = num_prealloc;