From: Axel Lin Date: Tue, 4 Jan 2011 22:40:04 +0000 (+0000) Subject: net: r6040: Return proper error for r6040_init_one X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9c86c0f4ba49b39f909d7f18731b91e563e07065;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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: Axel Lin Acked-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 0b014c894686..27e6f6d43cac 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c @@ -1153,6 +1153,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev, lp->mii_bus = mdiobus_alloc(); if (!lp->mii_bus) { dev_err(&pdev->dev, "mdiobus_alloc() failed\n"); + err = -ENOMEM; goto err_out_unmap; } @@ -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); if (!lp->mii_bus->irq) { dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); + err = -ENOMEM; goto err_out_mdio; }