Message ID | 1407448106-1819-1-git-send-email-u.kleine-koenig@pengutronix.de |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Date: Thu, 7 Aug 2014 23:48:24 +0200 > 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> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Aug 07, 2014 at 11:48:24PM +0200, Uwe Kleine-König wrote: > 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> > --- > No Fixes: footer here. The problem already exists in v2.6.31-rc1 (e.g. > commit 0b9da337dca9 (net: Rework ucc_geth driver to use of_mdio > infrastructure)). Didn't continue to research a specific commit. > --- > drivers/net/ethernet/freescale/ucc_geth.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c > index 36fc429298e3..5f1aab9c4ee7 100644 > --- a/drivers/net/ethernet/freescale/ucc_geth.c > +++ b/drivers/net/ethernet/freescale/ucc_geth.c > @@ -3864,8 +3864,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); > @@ -3899,6 +3902,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; > } > > @@ -3922,6 +3927,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); this must read: of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->phy_node); otherwise it fails to build. @davem: Should I send a fixup or a new version? Best regards Uwe
From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Date: Fri, 8 Aug 2014 22:34:56 +0200 > @davem: Should I send a fixup or a new version? Fixup, please. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 36fc429298e3..5f1aab9c4ee7 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3864,8 +3864,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); @@ -3899,6 +3902,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; } @@ -3922,6 +3927,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; }
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> --- No Fixes: footer here. The problem already exists in v2.6.31-rc1 (e.g. commit 0b9da337dca9 (net: Rework ucc_geth driver to use of_mdio infrastructure)). Didn't continue to research a specific commit. --- drivers/net/ethernet/freescale/ucc_geth.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)