netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh_eth: replace devm_kzalloc() with devm_kmalloc()
@ 2014-05-11 20:05 Sergei Shtylyov
  2014-05-12  0:10 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2014-05-11 20:05 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
PHY IRQ array right before initializing all its entries with PHY_POLL was quite
stupid. Now that devm_kmalloc() has become available, we can avoid the needless
zeroing out of the PHY IRQ array.

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

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

 drivers/net/ethernet/renesas/sh_eth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2627,7 +2627,7 @@ 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,
+	mdp->mii_bus->irq = devm_kmalloc(dev, sizeof(int) * PHY_MAX_ADDR,
 					 GFP_KERNEL);
 	if (!mdp->mii_bus->irq) {
 		ret = -ENOMEM;

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

* Re: [PATCH] sh_eth: replace devm_kzalloc() with devm_kmalloc()
  2014-05-11 20:05 [PATCH] sh_eth: replace devm_kzalloc() with devm_kmalloc() Sergei Shtylyov
@ 2014-05-12  0:10 ` Joe Perches
  2014-05-12 11:52   ` Sergei Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2014-05-12  0:10 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, linux-sh

On Mon, 2014-05-12 at 00:05 +0400, Sergei Shtylyov wrote:
> Now that devm_kmalloc() has become available, we can avoid the needless
> zeroing out of the PHY IRQ array.
[]
> net-next/drivers/net/ethernet/renesas/sh_eth.c
[]
> @@ -2627,7 +2627,7 @@ static int sh_mdio_init(struct sh_eth_pr
[]
> -	mdp->mii_bus->irq = devm_kzalloc(dev, sizeof(int) * PHY_MAX_ADDR,
> +	mdp->mii_bus->irq = devm_kmalloc(dev, sizeof(int) * PHY_MAX_ADDR,

perhaps

	mdp->mii_bus->irq = devm_kmalloc_array(dev, PHY_MAX_ADDR, sizeof(int),

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

* Re: [PATCH] sh_eth: replace devm_kzalloc() with devm_kmalloc()
  2014-05-12  0:10 ` Joe Perches
@ 2014-05-12 11:52   ` Sergei Shtylyov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2014-05-12 11:52 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev, linux-sh

Hello.

On 05/12/2014 04:10 AM, Joe Perches wrote:

>> Now that devm_kmalloc() has become available, we can avoid the needless
>> zeroing out of the PHY IRQ array.
> []
>> net-next/drivers/net/ethernet/renesas/sh_eth.c
> []
>> @@ -2627,7 +2627,7 @@ static int sh_mdio_init(struct sh_eth_pr
> []
>> -	mdp->mii_bus->irq = devm_kzalloc(dev, sizeof(int) * PHY_MAX_ADDR,
>> +	mdp->mii_bus->irq = devm_kmalloc(dev, sizeof(int) * PHY_MAX_ADDR,

> perhaps

> 	mdp->mii_bus->irq = devm_kmalloc_array(dev, PHY_MAX_ADDR, sizeof(int),

    Yes, that has occurred to me after I sent the patch...

WBR, Sergei


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

end of thread, other threads:[~2014-05-12 11:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-11 20:05 [PATCH] sh_eth: replace devm_kzalloc() with devm_kmalloc() Sergei Shtylyov
2014-05-12  0:10 ` Joe Perches
2014-05-12 11:52   ` Sergei Shtylyov

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