[PATCH] net: r6040: Return proper error for r6040_init_one

Subsystems: networking drivers, the rest

STALE5763d

3 messages, 3 authors, 2011-01-06 · open the first message on its own page

[PATCH] net: r6040: Return proper error for r6040_init_one

From: Axel Lin <hidden>
Date: 2011-01-05 08:38:15

Return -ENOMEM instead of 0 for the case of mdiobus_alloc and kmalloc failure.

Signed-off-by: Axel Lin <redacted>
---
 drivers/net/r6040.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 0b014c89..27e6f6d 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;
 	}
 
-- 
1.7.2

Re: [PATCH] net: r6040: Return proper error for r6040_init_one

From: Florian Fainelli <florian@openwrt.org>
Date: 2011-01-05 09:50:01

On Wednesday 05 January 2011 09:40:04 Axel Lin wrote:
Return -ENOMEM instead of 0 for the case of mdiobus_alloc and kmalloc
failure.

Signed-off-by: Axel Lin <redacted>
Acked-by: Florian Fainelli <florian@openwrt.org>
quoted hunk
---
 drivers/net/r6040.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 0b014c89..27e6f6d 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;
 	}

Re: [PATCH] net: r6040: Return proper error for r6040_init_one

From: David Miller <davem@davemloft.net>
Date: 2011-01-06 19:17:50

From: Florian Fainelli <florian@openwrt.org>
Date: Wed, 5 Jan 2011 10:50:45 +0100
On Wednesday 05 January 2011 09:40:04 Axel Lin wrote:
quoted
Return -ENOMEM instead of 0 for the case of mdiobus_alloc and kmalloc
failure.

Signed-off-by: Axel Lin <redacted>
Acked-by: Florian Fainelli <florian@openwrt.org>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help