Commit 85e75175 authored by Himanshu Jha's avatar Himanshu Jha Committed by Martin K. Petersen

scsi: bnx2i: Use zeroing allocator rather than allocator/memset

Use dma_zalloc_coherent instead of dma_alloc_coherent followed by
memset 0.

Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Suggested-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: default avatarHimanshu Jha <himanshujha199640@gmail.com>
Acked-by: default avatarManish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent bde70f3c
...@@ -1070,7 +1070,7 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) ...@@ -1070,7 +1070,7 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
/* Allocate memory area for actual SQ element */ /* Allocate memory area for actual SQ element */
ep->qp.sq_virt = ep->qp.sq_virt =
dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size, dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
&ep->qp.sq_phys, GFP_KERNEL); &ep->qp.sq_phys, GFP_KERNEL);
if (!ep->qp.sq_virt) { if (!ep->qp.sq_virt) {
printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n", printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n",
...@@ -1078,7 +1078,6 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) ...@@ -1078,7 +1078,6 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
goto mem_alloc_err; goto mem_alloc_err;
} }
memset(ep->qp.sq_virt, 0x00, ep->qp.sq_mem_size);
ep->qp.sq_first_qe = ep->qp.sq_virt; ep->qp.sq_first_qe = ep->qp.sq_virt;
ep->qp.sq_prod_qe = ep->qp.sq_first_qe; ep->qp.sq_prod_qe = ep->qp.sq_first_qe;
ep->qp.sq_cons_qe = ep->qp.sq_first_qe; ep->qp.sq_cons_qe = ep->qp.sq_first_qe;
...@@ -1107,14 +1106,13 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) ...@@ -1107,14 +1106,13 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
/* Allocate memory area for actual CQ element */ /* Allocate memory area for actual CQ element */
ep->qp.cq_virt = ep->qp.cq_virt =
dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size, dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size,
&ep->qp.cq_phys, GFP_KERNEL); &ep->qp.cq_phys, GFP_KERNEL);
if (!ep->qp.cq_virt) { if (!ep->qp.cq_virt) {
printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n", printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n",
ep->qp.cq_mem_size); ep->qp.cq_mem_size);
goto mem_alloc_err; goto mem_alloc_err;
} }
memset(ep->qp.cq_virt, 0x00, ep->qp.cq_mem_size);
ep->qp.cq_first_qe = ep->qp.cq_virt; ep->qp.cq_first_qe = ep->qp.cq_virt;
ep->qp.cq_prod_qe = ep->qp.cq_first_qe; ep->qp.cq_prod_qe = ep->qp.cq_first_qe;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment