From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Guo-Fu Tseng <cooldavid@cooldavid.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] net: jme: use kzalloc() instead of kmalloc+memset
Date: Wed, 9 Sep 2015 10:38:03 +0200 [thread overview]
Message-ID: <1441787886-7214-3-git-send-email-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <1441787886-7214-1-git-send-email-linux@rasmusvillemoes.dk>
Using kzalloc saves a tiny bit on .text.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
drivers/net/ethernet/jme.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 6e9a792097d3..060dd3922974 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -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;
@@ -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;
@@ -845,7 +843,7 @@ 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;
@@ -853,8 +851,6 @@ jme_setup_rx_resources(struct jme_adapter *jme)
/*
* 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);
--
2.1.3
next prev parent reply other threads:[~2015-09-09 8:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 8:38 [PATCH 0/4] net: a few kzalloc/memset cleanups Rasmus Villemoes
2015-09-09 8:38 ` [PATCH 1/4] net: cavium: liquidio: use kzalloc in setup_glist() Rasmus Villemoes
2015-09-09 8:38 ` Rasmus Villemoes [this message]
2015-09-09 8:38 ` [PATCH 3/4] net: mv643xx_eth: use kzalloc Rasmus Villemoes
2015-09-09 16:00 ` Joe Perches
2015-09-09 18:34 ` Rasmus Villemoes
2015-09-09 18:45 ` Joe Perches
2015-09-09 23:25 ` Joe Perches
2015-09-09 8:38 ` [PATCH 4/4] net: qlcnic: delete redundant memsets Rasmus Villemoes
2015-09-10 0:06 ` [PATCH 0/4] net: a few kzalloc/memset cleanups David Miller
2015-09-10 0:40 ` [PATCH] mv643xx_eth: Neaten mv643xx_eth_program_multicast_filter Joe Perches
2015-09-15 19:49 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441787886-7214-3-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=cooldavid@cooldavid.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome