RDMA/rw: use DIV_ROUND_UP to calculate nr_ops
PATCH 1/1 RDMA/rw: use DIV_ROUND_UP to calculate nr_ops
From: Max Gurtovoy <[email protected]>
Don't open-code DIV_ROUND_UP() kernel macro.
Signed-off-by Max Gurtovoy <[email protected]>
Signed-off-by Leon Romanovsky <[email protected]>
--- drivers/infiniband/core/rw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/rw.c +1 -1
@@ -129,7 +129,7 @@ static int rdma_rw_init_mr_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp, qp->integrity_en);int i, j, ret =0 , count =0 ; - ctx->nr_ops = (sg_cnt + pages_per_mr -1 ) / pages_per_mr; + ctx->nr_ops =DIV_ROUND_UP (sg_cnt, pages_per_mr); ctx->reg =kcalloc (ctx->nr_ops,sizeof (*ctx->reg),GFP_KERNEL );if (!ctx->reg) { ret = -ENOMEM ;
Signature · 1 line
2.25.2
Jason Gunthorpe
AppliedQuoted 9 lines · Leon Romanovsky
From: Max Gurtovoy <[email protected]>
Don't open-code
DIV_ROUND_UP()kernel macro.Signed-off-by Max Gurtovoy <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- drivers/infiniband/core/rw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next thanks
Jason