mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<jcliburn@gmail.com>, <chris.snook@gmail.com>, <benve@cisco.com>,
	<jdmason@kudzu.us>, <chessman@tux.org>, <jes@trained-monkey.org>,
	<rahul.verma@cavium.com>, YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH net-next 3/6] net: neterion: use pci_zalloc_consistent
Date: Tue, 5 Jun 2018 20:28:48 +0800	[thread overview]
Message-ID: <20180605122851.23912-4-yuehaibing@huawei.com> (raw)
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>

use pci_zalloc_consistent to remove unnecessary memset.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/ethernet/neterion/s2io.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index b8983e7..4e8a2fd 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -733,8 +733,8 @@ static int init_shared_mem(struct s2io_nic *nic)
 
 			rx_blocks = &ring->rx_blocks[j];
 			size = SIZE_OF_BLOCK;	/* size is always page size */
-			tmp_v_addr = pci_alloc_consistent(nic->pdev, size,
-							  &tmp_p_addr);
+			tmp_v_addr = pci_zalloc_consistent(nic->pdev, size,
+							   &tmp_p_addr);
 			if (tmp_v_addr == NULL) {
 				/*
 				 * In case of failure, free_shared_mem()
@@ -746,7 +746,6 @@ static int init_shared_mem(struct s2io_nic *nic)
 				return -ENOMEM;
 			}
 			mem_allocated += size;
-			memset(tmp_v_addr, 0, size);
 
 			size = sizeof(struct rxd_info) *
 				rxd_count[nic->rxd_mode];
@@ -835,8 +834,8 @@ static int init_shared_mem(struct s2io_nic *nic)
 	/* Allocation and initialization of Statistics block */
 	size = sizeof(struct stat_block);
 	mac_control->stats_mem =
-		pci_alloc_consistent(nic->pdev, size,
-				     &mac_control->stats_mem_phy);
+		pci_zalloc_consistent(nic->pdev, size,
+				      &mac_control->stats_mem_phy);
 
 	if (!mac_control->stats_mem) {
 		/*
@@ -851,7 +850,6 @@ static int init_shared_mem(struct s2io_nic *nic)
 
 	tmp_v_addr = mac_control->stats_mem;
 	mac_control->stats_info = tmp_v_addr;
-	memset(tmp_v_addr, 0, size);
 	DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n",
 		dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
 	mac_control->stats_info->sw_stat.mem_allocated += mem_allocated;
-- 
2.7.0

  parent reply	other threads:[~2018-06-05 12:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 12:28 [PATCH net-next 0/6] " YueHaibing
2018-06-05 12:28 ` [PATCH net-next 1/6] net: hippi: " YueHaibing
2018-06-06  9:53   ` Sergei Shtylyov
2018-06-06 15:04   ` kbuild test robot
2018-06-05 12:28 ` [PATCH net-next 2/6] net: atheros: " YueHaibing
2018-06-05 12:28 ` YueHaibing [this message]
2018-06-05 12:28 ` [PATCH net-next 4/6] netxen_nic: " YueHaibing
2018-06-06  9:56   ` Sergei Shtylyov
2018-06-05 12:28 ` [PATCH net-next 5/6] net: tlan: " YueHaibing
2018-06-05 12:28 ` [PATCH net-next 6/6] enic: " YueHaibing
2018-06-05 12:39 ` [PATCH net-next 0/6] " Andy Shevchenko
2018-06-05 12:49   ` Christoph Hellwig
2018-06-05 12:46     ` Andy Shevchenko
2018-06-05 13:04       ` YueHaibing
2018-06-05 13:00     ` 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=20180605122851.23912-4-yuehaibing@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=benve@cisco.com \
    --cc=chessman@tux.org \
    --cc=chris.snook@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jcliburn@gmail.com \
    --cc=jdmason@kudzu.us \
    --cc=jes@trained-monkey.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rahul.verma@cavium.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

all inboxes | Powered by JetHome®