netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sh_eth: replace devm_kzalloc() with devm_kmalloc_array()
@ 2014-05-12 22:30 Sergei Shtylyov
  2014-05-13 22:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sergei Shtylyov @ 2014-05-12 22:30 UTC (permalink / raw)
  To: netdev; +Cc: linux-sh

When I was converting the driver to the managed device API, only devm_kzalloc()
was available for memory allocation, so I had to use it, despite zeroing out the
PHY IRQ array right before initializing all  its entries to PHY_POLL was quite
stupid.   Now that devm_kmalloc_array() has become available, we can avoid the
needless zeroing out...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
This patch is against DaveM's 'net-next.git' repo.

Changes in version 2:
- switched to calling devm_kmalloc_array().

 drivers/net/ethernet/renesas/sh_eth.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -2627,8 +2627,8 @@ static int sh_mdio_init(struct sh_eth_pr
 		 pdev->name, pdev->id);
 
 	/* PHY IRQ */
-	mdp->mii_bus->irq = devm_kzalloc(dev, sizeof(int) * PHY_MAX_ADDR,
-					 GFP_KERNEL);
+	mdp->mii_bus->irq = devm_kmalloc_array(dev, PHY_MAX_ADDR, sizeof(int),
+					       GFP_KERNEL);
 	if (!mdp->mii_bus->irq) {
 		ret = -ENOMEM;
 		goto out_free_bus;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] sh_eth: replace devm_kzalloc() with devm_kmalloc_array()
  2014-05-12 22:30 [PATCH v2] sh_eth: replace devm_kzalloc() with devm_kmalloc_array() Sergei Shtylyov
@ 2014-05-13 22:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-05-13 22:51 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: netdev, linux-sh

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Tue, 13 May 2014 02:30:14 +0400

> When I was converting the driver to the managed device API, only devm_kzalloc()
> was available for memory allocation, so I had to use it, despite zeroing out the
> PHY IRQ array right before initializing all  its entries to PHY_POLL was quite
> stupid.   Now that devm_kmalloc_array() has become available, we can avoid the
> needless zeroing out...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Applied, thanks Sergei.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-13 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12 22:30 [PATCH v2] sh_eth: replace devm_kzalloc() with devm_kmalloc_array() Sergei Shtylyov
2014-05-13 22:51 ` David Miller

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).