net: r6040: Return proper error for r6040_init_one
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/net/r6040.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/r6040.c +2 -0
@@ -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; }
Signature · 1 line
1.7.2
Quoted 4 lines · On Wednesday 05 January 2011 09:40:04 Axel Lin wrote:
Return
-ENOMEMinstead of 0 for the case ofmdiobus_allocand kmalloc failure.Signed-off-by Axel Lin <[email protected]>
Acked-by Florian Fainelli <[email protected]>
Quoted 23 lines
--- drivers/net/r6040.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/net/r6040.c +2
-0@@ -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; }
From: Florian Fainelli <[email protected]>
Date: Wed, 5 Jan 2011 10:50:45 +0100
Quoted 7 lines · On Wednesday 05 January 2011 09:40:04 Axel Lin wrote:
Quoted 4 lines
Return
-ENOMEMinstead of 0 for the case ofmdiobus_allocand kmalloc failure.Signed-off-by Axel Lin <[email protected]>Acked-by Florian Fainelli <[email protected]>
Applied, thanks.