Skip to content

Commit

Permalink
net: jme: use kzalloc() instead of kmalloc+memset
Browse files Browse the repository at this point in the history
Using kzalloc saves a tiny bit on .text.

Signed-off-by: Rasmus Villemoes <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Villemoes authored and davem330 committed Sep 10, 2015
1 parent ce8e5c7 commit e9b5ac2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/net/ethernet/jme.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ jme_setup_tx_resources(struct jme_adapter *jme)
atomic_set(&txring->next_to_clean, 0);
atomic_set(&txring->nr_free, jme->tx_ring_size);

txring->bufinf = kmalloc(sizeof(struct jme_buffer_info) *
txring->bufinf = kzalloc(sizeof(struct jme_buffer_info) *
jme->tx_ring_size, GFP_ATOMIC);
if (unlikely(!(txring->bufinf)))
goto err_free_txring;
Expand All @@ -592,8 +592,6 @@ jme_setup_tx_resources(struct jme_adapter *jme)
* Initialize Transmit Descriptors
*/
memset(txring->alloc, 0, TX_RING_ALLOC_SIZE(jme->tx_ring_size));
memset(txring->bufinf, 0,
sizeof(struct jme_buffer_info) * jme->tx_ring_size);

return 0;

Expand Down Expand Up @@ -845,16 +843,14 @@ jme_setup_rx_resources(struct jme_adapter *jme)
rxring->next_to_use = 0;
atomic_set(&rxring->next_to_clean, 0);

rxring->bufinf = kmalloc(sizeof(struct jme_buffer_info) *
rxring->bufinf = kzalloc(sizeof(struct jme_buffer_info) *
jme->rx_ring_size, GFP_ATOMIC);
if (unlikely(!(rxring->bufinf)))
goto err_free_rxring;

/*
* Initiallize Receive Descriptors
*/
memset(rxring->bufinf, 0,
sizeof(struct jme_buffer_info) * jme->rx_ring_size);
for (i = 0 ; i < jme->rx_ring_size ; ++i) {
if (unlikely(jme_make_new_rx_buf(jme, i))) {
jme_free_rx_resources(jme);
Expand Down

0 comments on commit e9b5ac2

Please sign in to comment.