[PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc

STALE6949d

4 messages, 3 authors, 2007-08-08 · open the first message on its own page

[PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc

From: Mariusz Kozlowski <hidden>
Date: 2007-07-31 21:57:18

Signed-off-by: Mariusz Kozlowski <redacted>

 drivers/net/s2io.c | 235587 -> 235340 (-247 bytes)
 drivers/net/s2io.o | 460768 -> 460120 (-648 bytes)

 drivers/net/s2io.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
--- linux-2.6.23-rc1-mm1-a/drivers/net/s2io.c	2007-07-26 13:07:42.000000000 +0200
+++ linux-2.6.23-rc1-mm1-b/drivers/net/s2io.c	2007-07-31 13:44:02.000000000 +0200
@@ -531,7 +531,7 @@ static int init_shared_mem(struct s2io_n
 	for (i = 0; i < config->tx_fifo_num; i++) {
 		int fifo_len = config->tx_cfg[i].fifo_len;
 		int list_holder_size = fifo_len * sizeof(struct list_info_hold);
-		mac_control->fifos[i].list_info = kmalloc(list_holder_size,
+		mac_control->fifos[i].list_info = kzalloc(list_holder_size,
 							  GFP_KERNEL);
 		if (!mac_control->fifos[i].list_info) {
 			DBG_PRINT(INFO_DBG,
@@ -539,7 +539,6 @@ static int init_shared_mem(struct s2io_n
 			return -ENOMEM;
 		}
 		mem_allocated += list_holder_size;
-		memset(mac_control->fifos[i].list_info, 0, list_holder_size);
 	}
 	for (i = 0; i < config->tx_fifo_num; i++) {
 		int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
@@ -3788,9 +3787,9 @@ static int s2io_enable_msi_x(struct s2io
 	u16 msi_control; /* Temp variable */
 	int ret, i, j, msix_indx = 1;

-	nic->entries = kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct msix_entry),
+	nic->entries = kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct msix_entry),
 			       GFP_KERNEL);
-	if (nic->entries == NULL) {
+	if (!nic->entries) {
 		DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n", \
 			__FUNCTION__);
 		nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3798,12 +3797,11 @@ static int s2io_enable_msi_x(struct s2io
 	}
 	nic->mac_control.stats_info->sw_stat.mem_allocated
 		+= (MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));
-	memset(nic->entries, 0,MAX_REQUESTED_MSI_X * sizeof(struct msix_entry));

 	nic->s2io_entries =
-		kmalloc(MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry),
+		kcalloc(MAX_REQUESTED_MSI_X, sizeof(struct s2io_msix_entry),
 				   GFP_KERNEL);
-	if (nic->s2io_entries == NULL) {
+	if (!nic->s2io_entries) {
 		DBG_PRINT(INFO_DBG, "%s: Memory allocation failed\n",
 			__FUNCTION__);
 		nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
@@ -3814,8 +3812,6 @@ static int s2io_enable_msi_x(struct s2io
 	}
 	 nic->mac_control.stats_info->sw_stat.mem_allocated
 		+= (MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));
-	memset(nic->s2io_entries, 0,
-	       MAX_REQUESTED_MSI_X * sizeof(struct s2io_msix_entry));

 	for (i=0; i< MAX_REQUESTED_MSI_X; i++) {
 		nic->entries[i].entry = i;

Re: [PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc

From: Jeff Garzik <hidden>
Date: 2007-08-07 22:08:45

Mariusz Kozlowski wrote:
Signed-off-by: Mariusz Kozlowski <redacted>

 drivers/net/s2io.c | 235587 -> 235340 (-247 bytes)
 drivers/net/s2io.o | 460768 -> 460120 (-648 bytes)

 drivers/net/s2io.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
ACK but didn't apply, please wait 24-48 hours (so that s2io fixes go 
upstream), then rediff and resend

Re: [PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc

From: Jeff Garzik <hidden>
Date: 2007-08-08 16:34:20

Ramkrishna Vepa wrote:
We have a few patches queued and can send this patch in along with ours.
That would be great, thanks.

	Jeff


RE: [PATCH 68] drivers/net/s2io.c: kmalloc + memset conversion to k[cz]alloc

From: Ramkrishna Vepa <hidden>
Date: 2007-08-08 16:35:43

We have a few patches queued and can send this patch in along with ours.

Ram
-----Original Message-----
From: netdev-owner@vger.kernel.org
[mailto:netdev-owner@vger.kernel.org]
On Behalf Of Jeff Garzik
Sent: Tuesday, August 07, 2007 2:58 PM
To: Mariusz Kozlowski
Cc: linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org;
Andrew
Morton; netdev@vger.kernel.org
Subject: Re: [PATCH 68] drivers/net/s2io.c: kmalloc + memset
conversion to
k[cz]alloc

Mariusz Kozlowski wrote:
quoted
Signed-off-by: Mariusz Kozlowski <redacted>

 drivers/net/s2io.c | 235587 -> 235340 (-247 bytes)
 drivers/net/s2io.o | 460768 -> 460120 (-648 bytes)

 drivers/net/s2io.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
ACK but didn't apply, please wait 24-48 hours (so that s2io fixes go
upstream), then rediff and resend


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help