diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2014-08-07 17:48:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-07 19:02:59 -0400 |
commit | fa310789a488a8ca873a117d6d625368def71fb7 (patch) | |
tree | 8fdf8b3ec07e1c9527359d93620a0df6d840e576 /drivers/net/ethernet | |
parent | 129cc83a0b7ed9429d896e4f215d1f6a8c58ba40 (diff) |
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/ethernet')
-rw-r--r-- | drivers/net/ethernet/freescale/ucc_geth.c | 9 |
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) | |||
3862 | /* Create an ethernet device instance */ | 3862 | /* Create an ethernet device instance */ |
3863 | dev = alloc_etherdev(sizeof(*ugeth)); | 3863 | dev = alloc_etherdev(sizeof(*ugeth)); |
3864 | 3864 | ||
3865 | if (dev == NULL) | 3865 | if (dev == NULL) { |
3866 | of_node_put(ug_info->tbi_node); | ||
3867 | of_node_put(ug_info->phy_node); | ||
3866 | return -ENOMEM; | 3868 | return -ENOMEM; |
3869 | } | ||
3867 | 3870 | ||
3868 | ugeth = netdev_priv(dev); | 3871 | ugeth = netdev_priv(dev); |
3869 | spin_lock_init(&ugeth->lock); | 3872 | spin_lock_init(&ugeth->lock); |
@@ -3897,6 +3900,8 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3897 | pr_err("%s: Cannot register net device, aborting\n", | 3900 | pr_err("%s: Cannot register net device, aborting\n", |
3898 | dev->name); | 3901 | dev->name); |
3899 | free_netdev(dev); | 3902 | free_netdev(dev); |
3903 | of_node_put(ug_info->tbi_node); | ||
3904 | of_node_put(ug_info->phy_node); | ||
3900 | return err; | 3905 | return err; |
3901 | } | 3906 | } |
3902 | 3907 | ||
@@ -3920,6 +3925,8 @@ static int ucc_geth_remove(struct platform_device* ofdev) | |||
3920 | unregister_netdev(dev); | 3925 | unregister_netdev(dev); |
3921 | free_netdev(dev); | 3926 | free_netdev(dev); |
3922 | ucc_geth_memclean(ugeth); | 3927 | ucc_geth_memclean(ugeth); |
3928 | of_node_put(ugeth->info->tbi_node); | ||
3929 | of_node_put(ugeth->info->phy_node); | ||
3923 | 3930 | ||
3924 | return 0; | 3931 | return 0; |
3925 | } | 3932 | } |