提交 9c86c0f4 编写于 作者: A Axel Lin 提交者: David S. Miller

net: r6040: Return proper error for r6040_init_one

Return -ENOMEM instead of 0 for the case of mdiobus_alloc and kmalloc failure.
Signed-off-by: NAxel Lin <axel.lin@gmail.com>
Acked-by: NFlorian Fainelli <florian@openwrt.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2a8fe003
...@@ -1153,6 +1153,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, ...@@ -1153,6 +1153,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
lp->mii_bus = mdiobus_alloc(); lp->mii_bus = mdiobus_alloc();
if (!lp->mii_bus) { if (!lp->mii_bus) {
dev_err(&pdev->dev, "mdiobus_alloc() failed\n"); dev_err(&pdev->dev, "mdiobus_alloc() failed\n");
err = -ENOMEM;
goto err_out_unmap; goto err_out_unmap;
} }
...@@ -1165,6 +1166,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, ...@@ -1165,6 +1166,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); lp->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
if (!lp->mii_bus->irq) { if (!lp->mii_bus->irq) {
dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); dev_err(&pdev->dev, "mii_bus irq allocation failed\n");
err = -ENOMEM;
goto err_out_mdio; goto err_out_mdio;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册