net: bcmgenet: use kcalloc instead of kzalloc
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 23 Jul 2014 17:42:15 +0000 (10:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Jul 2014 22:14:26 +0000 (15:14 -0700)
There were two places that used kzalloc() with a multiplied sizeof(),
replace these with kcalloc as recommended by checkpatch.pl.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmmii.c

index 6ebc1b979c016ada4ad084b3750b2f0786266ff8..28c8111502cd4b9e12c4023e79332465e424f460 100644 (file)
@@ -1631,8 +1631,8 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv,
        priv->rx_bd_assign_index = 0;
        priv->rx_c_index = 0;
        priv->rx_read_ptr = 0;
-       priv->rx_cbs = kzalloc(priv->num_rx_bds * sizeof(struct enet_cb),
-                               GFP_KERNEL);
+       priv->rx_cbs = kcalloc(priv->num_rx_bds, sizeof(struct enet_cb),
+                              GFP_KERNEL);
        if (!priv->rx_cbs)
                return -ENOMEM;
 
@@ -1773,7 +1773,7 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv)
        /* Initialize commont TX ring structures */
        priv->tx_bds = priv->base + priv->hw_params->tdma_offset;
        priv->num_tx_bds = TOTAL_DESC;
-       priv->tx_cbs = kzalloc(priv->num_tx_bds * sizeof(struct enet_cb),
+       priv->tx_cbs = kcalloc(priv->num_tx_bds, sizeof(struct enet_cb),
                               GFP_KERNEL);
        if (!priv->tx_cbs) {
                bcmgenet_fini_dma(priv);
index bdd12410fbbe8f50bfb6ff1e9eb9ef9028484127..18961613d385aa5e8e0cd99cb54e0027f2f8ced1 100644 (file)
@@ -381,7 +381,7 @@ static int bcmgenet_mii_alloc(struct bcmgenet_priv *priv)
        snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d",
                 priv->pdev->name, priv->pdev->id);
 
-       bus->irq = kzalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
+       bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
        if (!bus->irq) {
                mdiobus_free(priv->mii_bus);
                return -ENOMEM;