From: Robert Eshleman <bobbyeshleman@gmail.com>
To: bobbyeshleman@gmail.com
Cc: Tariq Toukan <tariqt@mellanox.com>,
"David S. Miller" <davem@davemloft.net>,
Samuel Chessman <chessman@tux.org>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/8] tlan: use pci_zalloc instead of pci_alloc
Date: Tue, 26 Feb 2019 22:09:50 -0800 [thread overview]
Message-ID: <51125a3daac49f7b5bb360a422663aee26e6776b.1551246708.git.bobbyeshleman@gmail.com> (raw)
In-Reply-To: <cover.1551246708.git.bobbyeshleman@gmail.com>
This patch replaces a pci_alloc_consistent and memset(,0) call
with a single call to pci_zalloc_consistent.
Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com>
---
drivers/net/ethernet/ti/tlan.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index b4ab1a5f6cd0..e1f7e71c3b21 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -845,17 +845,16 @@ static int tlan_init(struct net_device *dev)
dma_size = (TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS)
* (sizeof(struct tlan_list));
- priv->dma_storage = pci_alloc_consistent(priv->pci_dev,
- dma_size,
- &priv->dma_storage_dma);
+ priv->dma_storage = pci_zalloc_consistent(priv->pci_dev,
+ dma_size,
+ &priv->dma_storage_dma);
priv->dma_size = dma_size;
- if (priv->dma_storage == NULL) {
+ if (!priv->dma_storage) {
pr_err("Could not allocate lists and buffers for %s\n",
dev->name);
return -ENOMEM;
}
- memset(priv->dma_storage, 0, dma_size);
priv->rx_list = (struct tlan_list *)
ALIGN((unsigned long)priv->dma_storage, 8);
priv->rx_list_dma = ALIGN(priv->dma_storage_dma, 8);
--
2.20.1
next prev parent reply other threads:[~2019-02-27 6:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-27 6:04 [PATCH 0/8] net: ethernet: reduce calls to memset(,0) Robert Eshleman
2019-02-27 6:09 ` [PATCH 2/8] net/mlxsw: use pci_zalloc_consistent instead of pci_alloc_consistent Robert Eshleman
2019-02-27 6:09 ` Robert Eshleman [this message]
2019-02-27 6:22 ` [PATCH 3/8] tlan: use pci_zalloc instead of pci_alloc Joe Perches
2019-02-28 0:41 ` Robert Eshleman
2019-02-27 6:09 ` [PATCH 4/8] qed: remove unnecessary memsets Robert Eshleman
2019-02-27 12:39 ` Michal Kalderon
2019-02-27 6:09 ` [PATCH 5/8] at12: use pci_zalloc instead of pci_alloc Robert Eshleman
2019-02-28 14:00 ` Christoph Hellwig
2019-02-27 6:09 ` [PATCH 6/8] netxen: remove unnecessary memset(,0) calls Robert Eshleman
2019-02-27 6:09 ` [PATCH 7/8] net: seeq: replace kmalloc / memset(,0) with kzalloc Robert Eshleman
2019-02-28 0:48 ` Robert Eshleman
2019-02-27 6:09 ` [PATCH 8/8] net: ethernet: ixp4xx_eth: remove memset(,0) with zalloc Robert Eshleman
2019-02-27 6:09 ` [PATCH 1/8] net/mlx4: use kzalloc instead of kmalloc Robert Eshleman
2019-02-28 8:40 ` Tariq Toukan
2019-02-28 14:25 ` [PATCH 0/8] net: ethernet: reduce calls to memset(,0) Christoph Hellwig
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=51125a3daac49f7b5bb360a422663aee26e6776b.1551246708.git.bobbyeshleman@gmail.com \
--to=bobbyeshleman@gmail.com \
--cc=chessman@tux.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tariqt@mellanox.com \
/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;
as well as URLs for NNTP newsgroup(s).