linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fs_enet: fix reference counting for phy_node
@ 2014-08-07 21:06 Uwe Kleine-König
  2014-08-07 23:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2014-08-07 21:06 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, linuxppc-dev, kernel, Vitaly Bordug

Make sure that fs_enet_probe is left with a reference to the phy node.
In the presence of a phy handle this is already the case as
of_parse_phandle returns a reference. In the fixed phy case a call to
of_node_get is necessary. Otherwise the error path and remove function
drop a reference the driver isn't holding.

Fixes: bb74d9a4a87b ("fs_enet: use the new fixed PHY helpers")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index cfaf17b70f3f..748fd24d3d9e 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1033,7 +1033,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
 		/* In the case of a fixed PHY, the DT node associated
 		 * to the PHY is the Ethernet MAC DT node.
 		 */
-		fpi->phy_node = ofdev->dev.of_node;
+		fpi->phy_node = of_node_get(ofdev->dev.of_node);
 	}
 
 	if (of_device_is_compatible(ofdev->dev.of_node, "fsl,mpc5125-fec")) {
-- 
2.0.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: fs_enet: fix reference counting for phy_node
  2014-08-07 21:06 [PATCH] net: fs_enet: fix reference counting for phy_node Uwe Kleine-König
@ 2014-08-07 23:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-08-07 23:07 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: f.fainelli, vbordug, netdev, kernel, linuxppc-dev

From: Uwe Kleine-K=F6nig <u.kleine-koenig@pengutronix.de>
Date: Thu,  7 Aug 2014 23:06:00 +0200

> Make sure that fs_enet_probe is left with a reference to the phy node=
.=

> In the presence of a phy handle this is already the case as
> of_parse_phandle returns a reference. In the fixed phy case a call to=

> of_node_get is necessary. Otherwise the error path and remove functio=
n
> drop a reference the driver isn't holding.
> =

> Fixes: bb74d9a4a87b ("fs_enet: use the new fixed PHY helpers")
> Signed-off-by: Uwe Kleine-K=F6nig <u.kleine-koenig@pengutronix.de>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-07 23:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07 21:06 [PATCH] net: fs_enet: fix reference counting for phy_node Uwe Kleine-König
2014-08-07 23:07 ` 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).