Skip to content

Commit

Permalink
ibmveth: consolidate kmalloc of array, memset 0 to kcalloc
Browse files Browse the repository at this point in the history
This is an API consolidation only. The use of kmalloc + memset to 0
is equivalent to kcalloc in this case as it is allocating an array
of elements.

Signed-off-by: Nicholas Mc Guire <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Nicholas Mc Guire authored and davem330 committed Dec 20, 2015
1 parent 958d104 commit 076ef44
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/ethernet/ibm/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static int ibmveth_alloc_buffer_pool(struct ibmveth_buff_pool *pool)
if (!pool->free_map)
return -1;

pool->dma_addr = kmalloc(sizeof(dma_addr_t) * pool->size, GFP_KERNEL);
pool->dma_addr = kcalloc(pool->size, sizeof(dma_addr_t), GFP_KERNEL);
if (!pool->dma_addr) {
kfree(pool->free_map);
pool->free_map = NULL;
Expand All @@ -187,8 +187,6 @@ static int ibmveth_alloc_buffer_pool(struct ibmveth_buff_pool *pool)
return -1;
}

memset(pool->dma_addr, 0, sizeof(dma_addr_t) * pool->size);

for (i = 0; i < pool->size; ++i)
pool->free_map[i] = i;

Expand Down

0 comments on commit 076ef44

Please sign in to comment.