summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2014-08-08 01:48:24 +0400
committerDavid S. Miller <davem@davemloft.net>2014-08-08 03:02:59 +0400
commitfa310789a488a8ca873a117d6d625368def71fb7 (patch)
tree8fdf8b3ec07e1c9527359d93620a0df6d840e576 /drivers/net
parent129cc83a0b7ed9429d896e4f215d1f6a8c58ba40 (diff)
downloadlinux-fa310789a488a8ca873a117d6d625368def71fb7.tar.xz
net: ucc_geth: drop acquired references in probe error path and remove
The ucc_geth_probe function assigns to ug_info->tbi_node and ug_info->phy_node a value returned by of_parse_phandle which returns a new reference. Put this reference again in the error path of ucc_geth_probe and when removing the device. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 8ceaf7a2660c..f6b956952269 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3862,8 +3862,11 @@ static int ucc_geth_probe(struct platform_device* ofdev)
/* Create an ethernet device instance */
dev = alloc_etherdev(sizeof(*ugeth));
- if (dev == NULL)
+ if (dev == NULL) {
+ of_node_put(ug_info->tbi_node);
+ of_node_put(ug_info->phy_node);
return -ENOMEM;
+ }
ugeth = netdev_priv(dev);
spin_lock_init(&ugeth->lock);
@@ -3897,6 +3900,8 @@ static int ucc_geth_probe(struct platform_device* ofdev)
pr_err("%s: Cannot register net device, aborting\n",
dev->name);
free_netdev(dev);
+ of_node_put(ug_info->tbi_node);
+ of_node_put(ug_info->phy_node);
return err;
}
@@ -3920,6 +3925,8 @@ static int ucc_geth_remove(struct platform_device* ofdev)
unregister_netdev(dev);
free_netdev(dev);
ucc_geth_memclean(ugeth);
+ of_node_put(ugeth->info->tbi_node);
+ of_node_put(ugeth->info->phy_node);
return 0;
}