Skip to content

Commit 9011a67

Browse files
JoePerchestorvalds
authored andcommitted
infiniband: use pci_zalloc_consistent
Remove the now unnecessary memset too. Signed-off-by: Joe Perches <joe@perches.com> Cc: Tom Tucker <tom@opengridcomputing.com> Acked-by: Steve Wise <swise@opengridcomputing.com> Cc: Roland Dreier <roland@kernel.org> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: Faisal Latif <faisal.latif@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7e83508 commit 9011a67

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

‎drivers/infiniband/hw/amso1100/c2.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,16 +604,14 @@ static int c2_up(struct net_device *netdev)
604604
tx_size = c2_port->tx_ring.count * sizeof(struct c2_tx_desc);
605605

606606
c2_port->mem_size = tx_size + rx_size;
607-
c2_port->mem = pci_alloc_consistent(c2dev->pcidev, c2_port->mem_size,
608-
&c2_port->dma);
607+
c2_port->mem = pci_zalloc_consistent(c2dev->pcidev, c2_port->mem_size,
608+
&c2_port->dma);
609609
if (c2_port->mem == NULL) {
610610
pr_debug("Unable to allocate memory for "
611611
"host descriptor rings\n");
612612
return -ENOMEM;
613613
}
614614

615-
memset(c2_port->mem, 0, c2_port->mem_size);
616-
617615
/* Create the Rx host descriptor ring */
618616
if ((ret =
619617
c2_rx_ring_alloc(&c2_port->rx_ring, c2_port->mem, c2_port->dma,

‎drivers/infiniband/hw/nes/nes_hw.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,13 +1003,13 @@ int nes_init_cqp(struct nes_device *nesdev)
10031003
(sizeof(struct nes_hw_aeqe) * nesadapter->max_qp) +
10041004
sizeof(struct nes_hw_cqp_qp_context);
10051005

1006-
nesdev->cqp_vbase = pci_alloc_consistent(nesdev->pcidev, nesdev->cqp_mem_size,
1007-
&nesdev->cqp_pbase);
1006+
nesdev->cqp_vbase = pci_zalloc_consistent(nesdev->pcidev,
1007+
nesdev->cqp_mem_size,
1008+
&nesdev->cqp_pbase);
10081009
if (!nesdev->cqp_vbase) {
10091010
nes_debug(NES_DBG_INIT, "Unable to allocate memory for host descriptor rings\n");
10101011
return -ENOMEM;
10111012
}
1012-
memset(nesdev->cqp_vbase, 0, nesdev->cqp_mem_size);
10131013

10141014
/* Allocate a twice the number of CQP requests as the SQ size */
10151015
nesdev->nes_cqp_requests = kzalloc(sizeof(struct nes_cqp_request) *
@@ -1691,13 +1691,13 @@ int nes_init_nic_qp(struct nes_device *nesdev, struct net_device *netdev)
16911691
(NES_NIC_WQ_SIZE * 2 * sizeof(struct nes_hw_nic_cqe)) +
16921692
sizeof(struct nes_hw_nic_qp_context);
16931693

1694-
nesvnic->nic_vbase = pci_alloc_consistent(nesdev->pcidev, nesvnic->nic_mem_size,
1695-
&nesvnic->nic_pbase);
1694+
nesvnic->nic_vbase = pci_zalloc_consistent(nesdev->pcidev,
1695+
nesvnic->nic_mem_size,
1696+
&nesvnic->nic_pbase);
16961697
if (!nesvnic->nic_vbase) {
16971698
nes_debug(NES_DBG_INIT, "Unable to allocate memory for NIC host descriptor rings\n");
16981699
return -ENOMEM;
16991700
}
1700-
memset(nesvnic->nic_vbase, 0, nesvnic->nic_mem_size);
17011701
nes_debug(NES_DBG_INIT, "Allocated NIC QP structures at %p (phys = %016lX), size = %u.\n",
17021702
nesvnic->nic_vbase, (unsigned long)nesvnic->nic_pbase, nesvnic->nic_mem_size);
17031703

‎drivers/infiniband/hw/nes/nes_verbs.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,16 +1616,15 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
16161616
entries, nescq->cq_mem_size, nescq->hw_cq.cq_number);
16171617

16181618
/* allocate the physical buffer space */
1619-
mem = pci_alloc_consistent(nesdev->pcidev, nescq->cq_mem_size,
1620-
&nescq->hw_cq.cq_pbase);
1619+
mem = pci_zalloc_consistent(nesdev->pcidev, nescq->cq_mem_size,
1620+
&nescq->hw_cq.cq_pbase);
16211621
if (!mem) {
16221622
printk(KERN_ERR PFX "Unable to allocate pci memory for cq\n");
16231623
nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
16241624
kfree(nescq);
16251625
return ERR_PTR(-ENOMEM);
16261626
}
16271627

1628-
memset(mem, 0, nescq->cq_mem_size);
16291628
nescq->hw_cq.cq_vbase = mem;
16301629
nescq->hw_cq.cq_head = 0;
16311630
nes_debug(NES_DBG_CQ, "CQ%u virtual address @ %p, phys = 0x%08X\n",

0 commit comments

Comments
 (0)