Skip to contentSkip to conversation

ethernet :mellanox :mlx4: Replace pci_pool_alloc by pci_pool_zalloc

PATCH Superseded Souptick Joarder 2 participants 4 messages Nov 29, 2016 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ethernet :mellanox :mlx4: Replace pci_pool_alloc by pci_pool_zalloc

In mlx4_alloc_cmd_mailbox(), pci_pool_alloc() followed by memset will be replaced by pci_pool_zalloc().

---
v2:
- Address comment from sergei
Alignment was not proper

 drivers/net/ethernet/mellanox/mlx4/cmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx4/cmd.c +2 -3
index e36bebc..96cdf9a 100644
@@ -2679,14 +2679,13 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
 	if (!mailbox)
 		return ERR_PTR(-ENOMEM);
 
-	mailbox->buf = pci_pool_alloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
-				      &mailbox->dma);
+	mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
+				       &mailbox->dma);
 	if (!mailbox->buf) {
 		kfree(mailbox);
 		return ERR_PTR(-ENOMEM);
 	}
 
-	memset(mailbox->buf, 0, MLX4_MAILBOX_SIZE);
 
 	return mailbox;
 }
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

Please ignore this v2 patch.

Quoted 34 lines · Souptick Joarder

In mlx4_alloc_cmd_mailbox(), pci_pool_alloc() followed by memset will be replaced by pci_pool_zalloc().

---
v2:
- Address comment from sergei
Alignment was not proper

 drivers/net/ethernet/mellanox/mlx4/cmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx4/cmd.c +2 -4
index e36bebc..96cdf9a 100644
@@ -2679,14 +2679,13 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
        if (!mailbox)
                return ERR_PTR(-ENOMEM);
 
-       mailbox->buf = pci_pool_alloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
-                                     &mailbox->dma);
+       mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
+                                      &mailbox->dma);
        if (!mailbox->buf) {
                kfree(mailbox);
                return ERR_PTR(-ENOMEM);
        }
 
-       memset(mailbox->buf, 0, MLX4_MAILBOX_SIZE);
 
        return mailbox;
 }
--
Quoted 2 lines

1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAFqt6zYzUyZ__7iVH3LwhGzeU7RN59-md4rcmwngRZW_ahDeAQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#3 lore raw

While sending the patch using "mutt" , alignment is getting changed. In original patch file alignment is proper and
I have tested the patch with "checkpatch.pl". Attach is the original patch file.

I am using mutt -H < patch-file>

Any suggestion will be helpful?

Quoted 32 lines · Souptick Joarder

Please ignore this v2 patch.

Quoted 29 lines · Souptick Joarder

In mlx4_alloc_cmd_mailbox(), pci_pool_alloc() followed by memset will be replaced by pci_pool_zalloc().

---
v2:
- Address comment from sergei
Alignment was not proper

 drivers/net/ethernet/mellanox/mlx4/cmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx4/cmd.c +2 -2
index e36bebc..96cdf9a 100644
@@ -2679,14 +2679,13 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
        if (!mailbox)
                return ERR_PTR(-ENOMEM);
 
-       mailbox->buf = pci_pool_alloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
-                                     &mailbox->dma);
+       mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
+                                      &mailbox->dma);
        if (!mailbox->buf) {
                kfree(mailbox);
                return ERR_PTR(-ENOMEM);
        }
 
Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/mellanox/mlx4/cmd.c +0 -2
-       memset(mailbox->buf, 0, MLX4_MAILBOX_SIZE);
 
        return mailbox;
 }
--

1.9.1

Regards
Souptick

From 3621eac92d271332ecc95b6f09ce25b7c6846137 Mon Sep 17 00:00:00 2001
From: Souptick Joarder <[email protected]>
Date: Tue, 29 Nov 2016 12:15:39 +0530
Subject: [PATCH v2] ethernet :mellanox :mlx4: Replace pci_pool_alloc by
pci_pool_zalloc

In mlx4_alloc_cmd_mailbox(), pci_pool_alloc() followed by memset will be replaced by pci_pool_zalloc().

---
v2:
- Address comment from sergei
Alignment was not proper

 drivers/net/ethernet/mellanox/mlx4/cmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx4/cmd.c +2 -3
index e36bebc..96cdf9a 100644
@@ -2679,14 +2679,13 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
 	if (!mailbox)
 		return ERR_PTR(-ENOMEM);
 
-	mailbox->buf = pci_pool_alloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
-				      &mailbox->dma);
+	mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
+				       &mailbox->dma);
 	if (!mailbox->buf) {
 		kfree(mailbox);
 		return ERR_PTR(-ENOMEM);
 	}
 
-	memset(mailbox->buf, 0, MLX4_MAILBOX_SIZE);
 
 	return mailbox;
 }
Signature · 1 line
1.9.1
#4 lore raw
In reply to Souptick Joarder

Hello.

Quoted 2 lines · Souptick Joarder

In mlx4_alloc_cmd_mailbox(), pci_pool_alloc() followed by memset will be replaced by pci_pool_zalloc().

One more nit since you're going to send it again...

Quoted 18 lines

---
v2:
- Address comment from sergei
Alignment was not proper

 drivers/net/ethernet/mellanox/mlx4/cmd.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx4/cmd.c +0 -1
index e36bebc..96cdf9a 100644
@@ -2679,14 +2679,13 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
 	if (!mailbox)
 		return ERR_PTR(-ENOMEM);
 
-	mailbox->buf = pci_pool_alloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,

drivers/net/ethernet/mellanox/mlx4/cmd.c struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev) · line 2689

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx4/cmd.c +2 -2
-				      &mailbox->dma);
+	mailbox->buf = pci_pool_zalloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
+				       &mailbox->dma);
 	if (!mailbox->buf) {
 		kfree(mailbox);
 		return ERR_PTR(-ENOMEM);
 	}
 
-	memset(mailbox->buf, 0, MLX4_MAILBOX_SIZE);
 

Remove empty line here -- one is enough.

drivers/net/ethernet/mellanox/mlx4/cmd.c struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev) · line 2691

Quoted 2 lines
drivers/net/ethernet/mellanox/mlx4/cmd.c +0 -0
 	return mailbox;
 }

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html