RDMA: Use kzalloc for allocating only one thing
authorZheng Yongjun <zhengyongjun3@huawei.com>
Tue, 29 Dec 2020 13:52:23 +0000 (21:52 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 7 Jan 2021 20:47:53 +0000 (16:47 -0400)
Use kzalloc rather than kcalloc(1,...)

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>

Link: https://lore.kernel.org/r/20201229135223.23815-1-zhengyongjun3@huawei.com
Link: https://lore.kernel.org/r/20201229135232.23869-1-zhengyongjun3@huawei.com
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/rw.c
drivers/infiniband/hw/cxgb4/restrack.c

index a96030b..31156e2 100644 (file)
@@ -410,7 +410,7 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
 
        ctx->type = RDMA_RW_SIG_MR;
        ctx->nr_ops = 1;
-       ctx->reg = kcalloc(1, sizeof(*ctx->reg), GFP_KERNEL);
+       ctx->reg = kzalloc(sizeof(*ctx->reg), GFP_KERNEL);
        if (!ctx->reg) {
                ret = -ENOMEM;
                goto out_unmap_prot_sg;
index b32e651..ff645b9 100644 (file)
@@ -209,7 +209,7 @@ int c4iw_fill_res_cm_id_entry(struct sk_buff *msg,
        epcp = (struct c4iw_ep_common *)iw_cm_id->provider_data;
        if (!epcp)
                return 0;
-       uep = kcalloc(1, sizeof(*uep), GFP_KERNEL);
+       uep = kzalloc(sizeof(*uep), GFP_KERNEL);
        if (!uep)
                return 0;