Skip to contentSkip to conversation

fs_enet: Fix a memory leak in fs_enet_mdio_probe

PATCH Superseded Scott Wood 2 participants 2 messages May 2, 2008

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/1 fs_enet: Fix a memory leak in fs_enet_mdio_probe

There are more memory leaks in the !PPC_CPM_NEW_BINDING case, but that code will disappear soon along with arch/ppc.

---
 drivers/net/fs_enet/mii-fec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/fs_enet/mii-fec.c +2 -1
index ba75efc..f0014cf 100644
@@ -194,7 +194,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
 
 	ret = of_address_to_resource(ofdev->node, 0, &res);
 	if (ret)
-		return ret;
+		goto out_res;
 
 	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
 
@@ -236,6 +236,7 @@ out_free_irqs:
 	kfree(new_bus->irq);
 out_unmap_regs:
 	iounmap(fec->fecp);
+out_res:
 out_fec:
 	kfree(fec);
 out_mii:
Signature · 1 line
1.5.4.4
#1 lore raw
Quoted 22 lines · On Fri, 2 May 2008 13:31:18 -0500 Scott Wood <[email protected]> wrote:

There are more memory leaks in the !PPC_CPM_NEW_BINDING case, but that code will disappear soon along with arch/ppc.

---
 drivers/net/fs_enet/mii-fec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/fs_enet/mii-fec.c +1 -1
index ba75efc..f0014cf 100644
@@ -194,7 +194,7 @@ static int __devinit fs_enet_mdio_probe(struct of_device *ofdev,
 
 	ret = of_address_to_resource(ofdev->node, 0, &res);
 	if (ret)
-		return ret;
+		goto out_res;
 
 	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
 

drivers/net/fs_enet/mii-fec.c out_free_irqs: · line 242

Quoted 7 lines
drivers/net/fs_enet/mii-fec.c +1 -0
@@ -236,6 +236,7 @@ out_free_irqs:
 	kfree(new_bus->irq);
 out_unmap_regs:
 	iounmap(fec->fecp);
+out_res:
 out_fec:
 	kfree(fec);
 out_mii:

It would be nice to credit Daniel Marjamki <[email protected]> in the changelog, please. Perhaps a mention of
http://bugzilla.kernel.org/show_bug.cgi?id=10591 also.