netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2]: ucc_geth: Fix use-after-of_node_put() in ucc_geth_probe().
@ 2009-03-29 10:18 David Miller
  0 siblings, 0 replies; only message in thread
From: David Miller @ 2009-03-29 10:18 UTC (permalink / raw)
  To: netdev


We can't put 'mdio' until after we've used it in the
fsl_pq_mdio_bus_name() call.

Also fix error return values.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/ucc_geth.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 86a479f..933fcfb 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3648,15 +3648,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
 		mdio = of_get_parent(phy);
 
 		if (mdio == NULL)
-			return -1;
+			return -ENODEV;
 
 		err = of_address_to_resource(mdio, 0, &res);
-		of_node_put(mdio);
-
-		if (err)
-			return -1;
 
+		if (err) {
+			of_node_put(mdio);
+			return err;
+		}
 		fsl_pq_mdio_bus_name(bus_name, mdio);
+		of_node_put(mdio);
 		snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
 			"%s:%02x", bus_name, *prop);
 	}
-- 
1.6.2.1.222.g570cc


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-29 10:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-29 10:18 [PATCH 2/2]: ucc_geth: Fix use-after-of_node_put() in ucc_geth_probe() David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).