sh_eth: replace devm_kzalloc() with devm_kmalloc_array()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Mon, 12 May 2014 22:30:14 +0000 (02:30 +0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 May 2014 22:51:27 +0000 (18:51 -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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index 967314cade95c5298f5d47f9093d70272c72dfbd..6a94ede699b4d016ea00dd31077cbeb719a18c29 100644 (file)
@@ -2627,8 +2627,8 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
                 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;