]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ucc_geth: Fix use-after-of_node_put() in ucc_geth_probe().
authorDavid S. Miller <davem@davemloft.net>
Sun, 29 Mar 2009 08:20:18 +0000 (01:20 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 29 Mar 2009 08:20:18 +0000 (01:20 -0700)
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

index 86a479f61c0c09dbceb64688f1bd2b131105031d..933fcfbf35e1ea332e29081b6ab84bd64a2fca5e 100644 (file)
@@ -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);
        }