diff mbox series

RDMA/hns:use dma_zalloc_coherent to replace dma_alloc_coherent and memset.

Message ID 1540216843-14118-1-git-send-email-allen.lkml@gmail.com (mailing list archive)
State Accepted
Commit 6d10550c84f51cb7c449c51d1a6fd31185a6ba6c
Headers show
Series RDMA/hns:use dma_zalloc_coherent to replace dma_alloc_coherent and memset. | expand

Commit Message

Allen Oct. 22, 2018, 2 p.m. UTC
From: Allen Pais <allen.pais@oracle.com>

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Doug Ledford Nov. 6, 2018, 9:02 p.m. UTC | #1
On Mon, 2018-10-22 at 19:30 +0530, Allen Pais wrote:
> From: Allen Pais <allen.pais@oracle.com>
> 
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>

Thanks, applied to for-next.
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 0218c0f..0a35870 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4816,13 +4816,12 @@  static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,
 				eqe_alloc = i * (buf_chk_sz / eq->eqe_size);
 				size = (eq->entries - eqe_alloc) * eq->eqe_size;
 			}
-			eq->buf[i] = dma_alloc_coherent(dev, size,
+			eq->buf[i] = dma_zalloc_coherent(dev, size,
 							&(eq->buf_dma[i]),
 							GFP_KERNEL);
 			if (!eq->buf[i])
 				goto err_dma_alloc_buf;
 
-			memset(eq->buf[i], 0, size);
 			*(eq->bt_l0 + i) = eq->buf_dma[i];
 
 			eq_buf_cnt++;
@@ -4852,13 +4851,12 @@  static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,
 					size = (eq->entries - eqe_alloc)
 						* eq->eqe_size;
 				}
-				eq->buf[idx] = dma_alloc_coherent(dev, size,
+				eq->buf[idx] = dma_zalloc_coherent(dev, size,
 							    &(eq->buf_dma[idx]),
 							    GFP_KERNEL);
 				if (!eq->buf[idx])
 					goto err_dma_alloc_buf;
 
-				memset(eq->buf[idx], 0, size);
 				*(eq->bt_l1[i] + j) = eq->buf_dma[idx];
 
 				eq_buf_cnt++;
@@ -4968,7 +4966,7 @@  static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev,
 			goto free_cmd_mbox;
 		}
 
-		eq->buf_list->buf = dma_alloc_coherent(dev, buf_chk_sz,
+		eq->buf_list->buf = dma_zalloc_coherent(dev, buf_chk_sz,
 						       &(eq->buf_list->map),
 						       GFP_KERNEL);
 		if (!eq->buf_list->buf) {
@@ -4976,7 +4974,6 @@  static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev,
 			goto err_alloc_buf;
 		}
 
-		memset(eq->buf_list->buf, 0, buf_chk_sz);
 	} else {
 		ret = hns_roce_mhop_alloc_eq(hr_dev, eq);
 		if (ret) {