Commit 24b9bdff authored by Ivan Bornyakov's avatar Ivan Bornyakov Committed by Greg Kroah-Hartman

staging: gasket: use vzalloc instead of vmalloc/memset

Use vzalloc instead of vmalloc followed by memset with 0.
Signed-off-by: default avatarIvan Bornyakov <brnkv.i1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent afa9e318
...@@ -330,7 +330,7 @@ int gasket_page_table_init( ...@@ -330,7 +330,7 @@ int gasket_page_table_init(
pg_tbl = *ppg_tbl; pg_tbl = *ppg_tbl;
bytes = total_entries * sizeof(struct gasket_page_table_entry); bytes = total_entries * sizeof(struct gasket_page_table_entry);
if (bytes != 0) { if (bytes != 0) {
pg_tbl->entries = vmalloc(bytes); pg_tbl->entries = vzalloc(bytes);
if (!pg_tbl->entries) { if (!pg_tbl->entries) {
gasket_nodev_debug( gasket_nodev_debug(
"No memory for address translation metadata."); "No memory for address translation metadata.");
...@@ -338,7 +338,6 @@ int gasket_page_table_init( ...@@ -338,7 +338,6 @@ int gasket_page_table_init(
*ppg_tbl = NULL; *ppg_tbl = NULL;
return -ENOMEM; return -ENOMEM;
} }
memset(pg_tbl->entries, 0, bytes);
} }
mutex_init(&pg_tbl->mutex); mutex_init(&pg_tbl->mutex);
...@@ -1054,13 +1053,12 @@ static int gasket_alloc_extended_subtable( ...@@ -1054,13 +1053,12 @@ static int gasket_alloc_extended_subtable(
subtable_bytes = sizeof(struct gasket_page_table_entry) * subtable_bytes = sizeof(struct gasket_page_table_entry) *
GASKET_PAGES_PER_SUBTABLE; GASKET_PAGES_PER_SUBTABLE;
pte->sublevel = vmalloc(subtable_bytes); pte->sublevel = vzalloc(subtable_bytes);
if (!pte->sublevel) { if (!pte->sublevel) {
free_page(page_addr); free_page(page_addr);
memset(pte, 0, sizeof(struct gasket_page_table_entry)); memset(pte, 0, sizeof(struct gasket_page_table_entry));
return -ENOMEM; return -ENOMEM;
} }
memset(pte->sublevel, 0, subtable_bytes);
/* Map the page into DMA space. */ /* Map the page into DMA space. */
if (pg_tbl->dma_ops) { if (pg_tbl->dma_ops) {
......
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