xlr_net: Fix missing trivial allocation check

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alan Cox 2014-02-05 11:56:43 +00:00 committed by Greg Kroah-Hartman
parent e6ff3f4e6d
commit ad3815a595
1 changed files with 5 additions and 0 deletions

View File

@ -892,6 +892,11 @@ static int xlr_setup_mdio(struct xlr_net_priv *priv,
priv->mii_bus->write = xlr_mii_write; priv->mii_bus->write = xlr_mii_write;
priv->mii_bus->parent = &pdev->dev; priv->mii_bus->parent = &pdev->dev;
priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); priv->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
if (priv->mii_bus->irq == NULL) {
pr_err("irq alloc failed\n");
mdiobus_free(priv->mii_bus);
return -ENOMEM;
}
priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq; priv->mii_bus->irq[priv->phy_addr] = priv->ndev->irq;
/* Scan only the enabled address */ /* Scan only the enabled address */