RDMA: Use vzalloc() to replace vmalloc()+memset(0)
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:

gecommit door
Roland Dreier

bovenliggende
4162cf6497
commit
948579cd8c
@@ -199,12 +199,11 @@ static struct ipath_devdata *ipath_alloc_devdata(struct pci_dev *pdev)
|
||||
goto bail;
|
||||
}
|
||||
|
||||
dd = vmalloc(sizeof(*dd));
|
||||
dd = vzalloc(sizeof(*dd));
|
||||
if (!dd) {
|
||||
dd = ERR_PTR(-ENOMEM);
|
||||
goto bail;
|
||||
}
|
||||
memset(dd, 0, sizeof(*dd));
|
||||
dd->ipath_unit = -1;
|
||||
|
||||
spin_lock_irqsave(&ipath_devs_lock, flags);
|
||||
|
@@ -1530,7 +1530,7 @@ static int init_subports(struct ipath_devdata *dd,
|
||||
}
|
||||
|
||||
num_subports = uinfo->spu_subport_cnt;
|
||||
pd->subport_uregbase = vmalloc(PAGE_SIZE * num_subports);
|
||||
pd->subport_uregbase = vzalloc(PAGE_SIZE * num_subports);
|
||||
if (!pd->subport_uregbase) {
|
||||
ret = -ENOMEM;
|
||||
goto bail;
|
||||
@@ -1538,13 +1538,13 @@ static int init_subports(struct ipath_devdata *dd,
|
||||
/* Note: pd->port_rcvhdrq_size isn't initialized yet. */
|
||||
size = ALIGN(dd->ipath_rcvhdrcnt * dd->ipath_rcvhdrentsize *
|
||||
sizeof(u32), PAGE_SIZE) * num_subports;
|
||||
pd->subport_rcvhdr_base = vmalloc(size);
|
||||
pd->subport_rcvhdr_base = vzalloc(size);
|
||||
if (!pd->subport_rcvhdr_base) {
|
||||
ret = -ENOMEM;
|
||||
goto bail_ureg;
|
||||
}
|
||||
|
||||
pd->subport_rcvegrbuf = vmalloc(pd->port_rcvegrbuf_chunks *
|
||||
pd->subport_rcvegrbuf = vzalloc(pd->port_rcvegrbuf_chunks *
|
||||
pd->port_rcvegrbuf_size *
|
||||
num_subports);
|
||||
if (!pd->subport_rcvegrbuf) {
|
||||
@@ -1556,11 +1556,6 @@ static int init_subports(struct ipath_devdata *dd,
|
||||
pd->port_subport_id = uinfo->spu_subport_id;
|
||||
pd->active_slaves = 1;
|
||||
set_bit(IPATH_PORT_MASTER_UNINIT, &pd->port_flag);
|
||||
memset(pd->subport_uregbase, 0, PAGE_SIZE * num_subports);
|
||||
memset(pd->subport_rcvhdr_base, 0, size);
|
||||
memset(pd->subport_rcvegrbuf, 0, pd->port_rcvegrbuf_chunks *
|
||||
pd->port_rcvegrbuf_size *
|
||||
num_subports);
|
||||
goto bail;
|
||||
|
||||
bail_rhdr:
|
||||
|
@@ -442,7 +442,7 @@ static void init_shadow_tids(struct ipath_devdata *dd)
|
||||
struct page **pages;
|
||||
dma_addr_t *addrs;
|
||||
|
||||
pages = vmalloc(dd->ipath_cfgports * dd->ipath_rcvtidcnt *
|
||||
pages = vzalloc(dd->ipath_cfgports * dd->ipath_rcvtidcnt *
|
||||
sizeof(struct page *));
|
||||
if (!pages) {
|
||||
ipath_dev_err(dd, "failed to allocate shadow page * "
|
||||
@@ -461,9 +461,6 @@ static void init_shadow_tids(struct ipath_devdata *dd)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(pages, 0, dd->ipath_cfgports * dd->ipath_rcvtidcnt *
|
||||
sizeof(struct page *));
|
||||
|
||||
dd->ipath_pageshadow = pages;
|
||||
dd->ipath_physshadow = addrs;
|
||||
}
|
||||
|
Verwijs in nieuw issue
Block a user