diff mbox

sh_eth: replace devm_kzalloc() with devm_kmalloc()

Message ID 201405120005.51199.sergei.shtylyov@cogentembedded.com (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Sergei Shtylyov May 11, 2014, 8:05 p.m. UTC
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(-)

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

Comments

Joe Perches May 12, 2014, 12:10 a.m. UTC | #1
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),



--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov May 12, 2014, 11:52 a.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;