diff options
author | Joe Perches <joe@perches.com> | 2010-11-04 23:07:36 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2011-01-12 14:11:58 -0500 |
commit | 948579cd8c6ea7c8c98c52b79f4470952e182ebd (patch) | |
tree | 77e85adbdd07be8394fa60d08d3f1dbda3c67393 /drivers/infiniband/hw/ipath | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
RDMA: Use vzalloc() to replace vmalloc()+memset(0)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_driver.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_file_ops.c | 11 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_init_chip.c | 5 |
3 files changed, 5 insertions, 14 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index b33f0457a1f..ae92da2d3f5 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -199,12 +199,11 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev) | |||
199 | goto bail; | 199 | goto bail; |
200 | } | 200 | } |
201 | 201 | ||
202 | dd = vmalloc(sizeof(*dd)); | 202 | dd = vzalloc(sizeof(*dd)); |
203 | if (!dd) { | 203 | if (!dd) { |
204 | dd = ERR_PTR(-ENOMEM); | 204 | dd = ERR_PTR(-ENOMEM); |
205 | goto bail; | 205 | goto bail; |
206 | } | 206 | } |
207 | memset(dd, 0, sizeof(*dd)); | ||
208 | dd->ipath_unit = -1; | 207 | dd->ipath_unit = -1; |
209 | 208 | ||
210 | spin_lock_irqsave(&ipath_devs_lock, flags); | 209 | spin_lock_irqsave(&ipath_devs_lock, flags); |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 9292a15ad7c..6d4b29c4cd8 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -1530,7 +1530,7 @@ static int init_subports(struct ipath_devdata *dd, | |||
1530 | } | 1530 | } |
1531 | 1531 | ||
1532 | num_subports = uinfo->spu_subport_cnt; | 1532 | num_subports = uinfo->spu_subport_cnt; |
1533 | pd->subport_uregbase = vmalloc(PAGE_SIZE * num_subports); | 1533 | pd->subport_uregbase = vzalloc(PAGE_SIZE * num_subports); |
1534 | if (!pd->subport_uregbase) { | 1534 | if (!pd->subport_uregbase) { |
1535 | ret = -ENOMEM; | 1535 | ret = -ENOMEM; |
1536 | goto bail; | 1536 | goto bail; |
@@ -1538,13 +1538,13 @@ static int init_subports(struct ipath_devdata *dd, | |||
1538 | /* Note: pd->port_rcvhdrq_size isn't initialized yet. */ | 1538 | /* Note: pd->port_rcvhdrq_size isn't initialized yet. */ |
1539 | size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * | 1539 | size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize * |
1540 | sizeof(u32), PAGE_SIZE) * num_subports; | 1540 | sizeof(u32), PAGE_SIZE) * num_subports; |
1541 | pd->subport_rcvhdr_base = vmalloc(size); | 1541 | pd->subport_rcvhdr_base = vzalloc(size); |
1542 | if (!pd->subport_rcvhdr_base) { | 1542 | if (!pd->subport_rcvhdr_base) { |
1543 | ret = -ENOMEM; | 1543 | ret = -ENOMEM; |
1544 | goto bail_ureg; | 1544 | goto bail_ureg; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | pd->subport_rcvegrbuf = vmalloc(pd->port_rcvegrbuf_chunks * | 1547 | pd->subport_rcvegrbuf = vzalloc(pd->port_rcvegrbuf_chunks * |
1548 | pd->port_rcvegrbuf_size * | 1548 | pd->port_rcvegrbuf_size * |
1549 | num_subports); | 1549 | num_subports); |
1550 | if (!pd->subport_rcvegrbuf) { | 1550 | if (!pd->subport_rcvegrbuf) { |
@@ -1556,11 +1556,6 @@ static int init_subports(struct ipath_devdata *dd, | |||
1556 | pd->port_subport_id = uinfo->spu_subport_id; | 1556 | pd->port_subport_id = uinfo->spu_subport_id; |
1557 | pd->active_slaves = 1; | 1557 | pd->active_slaves = 1; |
1558 | set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag); | 1558 | set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag); |
1559 | memset(pd->subport_uregbase, 0, PAGE_SIZE * num_subports); | ||
1560 | memset(pd->subport_rcvhdr_base, 0, size); | ||
1561 | memset(pd->subport_rcvegrbuf, 0, pd->port_rcvegrbuf_chunks * | ||
1562 | pd->port_rcvegrbuf_size * | ||
1563 | num_subports); | ||
1564 | goto bail; | 1559 | goto bail; |
1565 | 1560 | ||
1566 | bail_rhdr: | 1561 | bail_rhdr: |
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index 776938299e4..fef0f420125 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c | |||
@@ -442,7 +442,7 @@ static void init_shadow_tids(struct ipath_devdata *dd) | |||
442 | struct page **pages; | 442 | struct page **pages; |
443 | dma_addr_t *addrs; | 443 | dma_addr_t *addrs; |
444 | 444 | ||
445 | pages = vmalloc(dd->ipath_cfgports * dd->ipath_rcvtidcnt * | 445 | pages = vzalloc(dd->ipath_cfgports * dd->ipath_rcvtidcnt * |
446 | sizeof(struct page *)); | 446 | sizeof(struct page *)); |
447 | if (!pages) { | 447 | if (!pages) { |
448 | ipath_dev_err(dd, "failed to allocate shadow page * " | 448 | ipath_dev_err(dd, "failed to allocate shadow page * " |
@@ -461,9 +461,6 @@ static void init_shadow_tids(struct ipath_devdata *dd) | |||
461 | return; | 461 | return; |
462 | } | 462 | } |
463 | 463 | ||
464 | memset(pages, 0, dd->ipath_cfgports * dd->ipath_rcvtidcnt * | ||
465 | sizeof(struct page *)); | ||
466 | |||
467 | dd->ipath_pageshadow = pages; | 464 | dd->ipath_pageshadow = pages; |
468 | dd->ipath_physshadow = addrs; | 465 | dd->ipath_physshadow = addrs; |
469 | } | 466 | } |