[PATCH rdma-next 07/15] RDMA/cxgb3: Zero all allocated memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leon Romanovsky <leonro@xxxxxxxxxxxx>

Replace general allocations to be zero based.

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 drivers/infiniband/hw/cxgb3/cxio_hal.c      |  4 ++--
 drivers/infiniband/hw/cxgb3/cxio_resource.c |  2 +-
 drivers/infiniband/hw/cxgb3/iwch_provider.c | 10 +++++-----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 3328acc53c2a..ccfc838147b3 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -219,7 +219,7 @@ static u32 get_qpid(struct cxio_rdev *rdev_p, struct cxio_ucontext *uctx)
 		if (!qpid)
 			goto out;
 		for (i = qpid+1; i & rdev_p->qpmask; i++) {
-			entry = kmalloc(sizeof *entry, GFP_KERNEL);
+			entry = kzalloc(sizeof *entry, GFP_KERNEL);
 			if (!entry)
 				break;
 			entry->qpid = i;
@@ -237,7 +237,7 @@ static void put_qpid(struct cxio_rdev *rdev_p, u32 qpid,
 {
 	struct cxio_qpid_list *entry;
 
-	entry = kmalloc(sizeof *entry, GFP_KERNEL);
+	entry = kzalloc(sizeof *entry, GFP_KERNEL);
 	if (!entry)
 		return;
 	pr_debug("%s qpid 0x%x\n", __func__, qpid);
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c
index c6e7bc4420b6..30a8c59ded46 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_resource.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c
@@ -144,7 +144,7 @@ int cxio_hal_init_resource(struct cxio_rdev *rdev_p,
 	int err = 0;
 	struct cxio_hal_resource *rscp;
 
-	rscp = kmalloc(sizeof(*rscp), GFP_KERNEL);
+	rscp = kzalloc(sizeof(*rscp), GFP_KERNEL);
 	if (!rscp)
 		return -ENOMEM;
 	rdev_p->rscp = rscp;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 1804b6c4a6ec..0212d6fecd61 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -212,7 +212,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev,
 	if (ucontext) {
 		struct iwch_mm_entry *mm;
 
-		mm = kmalloc(sizeof *mm, GFP_KERNEL);
+		mm = kzalloc(sizeof *mm, GFP_KERNEL);
 		if (!mm) {
 			iwch_destroy_cq(&chp->ibcq);
 			return ERR_PTR(-ENOMEM);
@@ -506,7 +506,7 @@ static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc)
 		goto err;
 	}
 
-	page_list = kmalloc_array(npages, sizeof(u64), GFP_KERNEL);
+	page_list = kcalloc(npages, sizeof(u64), GFP_KERNEL);
 	if (!page_list) {
 		ret = -ENOMEM;
 		goto err;
@@ -930,13 +930,13 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd,
 
 		struct iwch_mm_entry *mm1, *mm2;
 
-		mm1 = kmalloc(sizeof *mm1, GFP_KERNEL);
+		mm1 = kzalloc(sizeof *mm1, GFP_KERNEL);
 		if (!mm1) {
 			iwch_destroy_qp(&qhp->ibqp);
 			return ERR_PTR(-ENOMEM);
 		}
 
-		mm2 = kmalloc(sizeof *mm2, GFP_KERNEL);
+		mm2 = kzalloc(sizeof *mm2, GFP_KERNEL);
 		if (!mm2) {
 			kfree(mm1);
 			iwch_destroy_qp(&qhp->ibqp);
@@ -1424,7 +1424,7 @@ int iwch_register_device(struct iwch_dev *dev)
 	dev->ibdev.get_port_immutable = iwch_port_immutable;
 	dev->ibdev.get_dev_fw_str = get_dev_fw_ver_str;
 
-	dev->ibdev.iwcm = kmalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL);
+	dev->ibdev.iwcm = kzalloc(sizeof(struct iw_cm_verbs), GFP_KERNEL);
 	if (!dev->ibdev.iwcm)
 		return -ENOMEM;
 
-- 
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux