All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle
@ 2016-08-01  7:02 Peter Chen
  2016-08-01  7:02 ` [PATCH v2 01/15] ethernet: altera: add missing of_node_put Peter Chen
                   ` (15 more replies)
  0 siblings, 16 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

Hi David,

This patch set fixes missing of_node_put issue at ethernet driver.
of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

The compilation test has passed by using allmodconfig for drivers/net/ethernet.

Thanks.

Changes for v2:
- If the device node is local variable, it can be put in the same function.
- If the device node will be used the whole driver life cycle,
  it should be put (call of_node_put) at driver's remove. 
  Patch [4, 5, 9, 14, 15/15]
- Fix the issue that the node still be used at error patch [6/15]
- Add acked for patch [11,12/15]

Peter Chen (15):
  ethernet: altera: add missing of_node_put
  ethernet: apm: xgene: add missing of_node_put after calling
    of_parse_phandle
  ethernet: arc: emac_main: add missing of_node_put after calling
    of_parse_phandle
  ethernet: aurora: nb8800: add missing of_node_put after calling
    of_parse_phandle
  ethernet: cavium: octeon: add missing of_node_put after calling
    of_parse_phandle
  ethernet: hisilicon: hns: hns_dsaf_mac: add missing of_node_put after
    calling of_parse_phandle
  ethernet: hisilicon: hns: hns_dsaf_main: add missing of_node_put after
    calling of_parse_phandle
  ethernet: marvell: mvneta: add missing of_node_put after calling
    of_parse_phandle
  ethernet: marvell: mvpp2: add missing of_node_put after calling
    of_parse_phandle
  ethernet: marvell: pxa168_eth: add missing of_node_put after calling
    of_parse_phandle
  ethernet: renesas: ravb_main: add missing of_node_put after calling
    of_parse_phandle
  ethernet: renesas: sh_eth: add missing of_node_put after calling
    of_parse_phandle
  ethernet: stmicro: stmmac: dwmac-socfpga: add missing of_node_put
    after calling of_parse_phandle
  ethernet: stmicro: stmmac: add missing of_node_put after calling
    of_parse_phandle
  ethernet: ti: davinci_emac: add missing of_node_put after calling
    of_parse_phandle

 drivers/net/ethernet/altera/altera_tse_main.c      |  1 +
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c     |  1 +
 drivers/net/ethernet/arc/emac_main.c               | 15 ++++++---
 drivers/net/ethernet/aurora/nb8800.c               |  2 ++
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c   |  3 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c  |  9 ++++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c |  7 +++--
 drivers/net/ethernet/marvell/mvneta.c              |  1 +
 drivers/net/ethernet/marvell/mvpp2.c               |  2 ++
 drivers/net/ethernet/marvell/pxa168_eth.c          |  1 +
 drivers/net/ethernet/renesas/ravb_main.c           |  1 +
 drivers/net/ethernet/renesas/sh_eth.c              |  1 +
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 36 ++++++++++++++++------
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  1 +
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  7 +++--
 drivers/net/ethernet/ti/davinci_emac.c             |  1 +
 16 files changed, 67 insertions(+), 22 deletions(-)

-- 
1.9.1

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

* [PATCH v2 01/15] ethernet: altera: add missing of_node_put
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 02/15] ethernet: apm: xgene: add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle (or of_node_get) has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/altera/altera_tse_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 49025e9..bda31f3 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -815,6 +815,7 @@ static int init_phy(struct net_device *dev)
 		phydev = of_phy_connect(dev, phynode,
 			&altera_tse_adjust_link, 0, priv->phy_iface);
 	}
+	of_node_put(phynode);
 
 	if (!phydev) {
 		netdev_err(dev, "Could not find the PHY\n");
-- 
1.9.1

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

* [PATCH v2 02/15] ethernet: apm: xgene: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
  2016-08-01  7:02 ` [PATCH v2 01/15] ethernet: altera: add missing of_node_put Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 03/15] ethernet: arc: emac_main: " Peter Chen
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 2f5638f..fb23408 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -758,6 +758,7 @@ static int xgene_enet_phy_connect(struct net_device *ndev)
 
 		phy_dev = of_phy_connect(ndev, phy_np, &xgene_enet_adjust_link,
 					 0, pdata->phy_mode);
+		of_node_put(phy_np);
 		if (!phy_dev) {
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return -ENODEV;
-- 
1.9.1

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

* [PATCH v2 03/15] ethernet: arc: emac_main: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
  2016-08-01  7:02 ` [PATCH v2 01/15] ethernet: altera: add missing of_node_put Peter Chen
  2016-08-01  7:02 ` [PATCH v2 02/15] ethernet: apm: xgene: add missing of_node_put after calling of_parse_phandle Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 04/15] ethernet: aurora: nb8800: " Peter Chen
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/arc/emac_main.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 586beda..4bff0f3 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -749,14 +749,16 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 	err = of_address_to_resource(dev->of_node, 0, &res_regs);
 	if (err) {
 		dev_err(dev, "failed to retrieve registers base from device tree\n");
-		return -ENODEV;
+		err = -ENODEV;
+		goto out_put_node;
 	}
 
 	/* Get IRQ from device tree */
 	irq = irq_of_parse_and_map(dev->of_node, 0);
 	if (!irq) {
 		dev_err(dev, "failed to retrieve <irq> value from device tree\n");
-		return -ENODEV;
+		err = -ENODEV;
+		goto out_put_node;
 	}
 
 	ndev->netdev_ops = &arc_emac_netdev_ops;
@@ -778,7 +780,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 		err = clk_prepare_enable(priv->clk);
 		if (err) {
 			dev_err(dev, "failed to enable clock\n");
-			return err;
+			goto out_put_node;
 		}
 
 		clock_frequency = clk_get_rate(priv->clk);
@@ -787,7 +789,8 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 		if (of_property_read_u32(dev->of_node, "clock-frequency",
 					 &clock_frequency)) {
 			dev_err(dev, "failed to retrieve <clock-frequency> from device tree\n");
-			return -EINVAL;
+			err = -EINVAL;
+			goto out_put_node;
 		}
 	}
 
@@ -867,6 +870,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 		goto out_netif_api;
 	}
 
+	of_node_put(phy_node);
 	return 0;
 
 out_netif_api:
@@ -877,6 +881,9 @@ out_mdio:
 out_clken:
 	if (priv->clk)
 		clk_disable_unprepare(priv->clk);
+out_put_node:
+	of_node_put(phy_node);
+
 	return err;
 }
 EXPORT_SYMBOL_GPL(arc_emac_probe);
-- 
1.9.1

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

* [PATCH v2 04/15] ethernet: aurora: nb8800: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (2 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 03/15] ethernet: arc: emac_main: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 05/15] ethernet: cavium: octeon: " Peter Chen
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/aurora/nb8800.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index 0d4ea92..b047fd6 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1504,6 +1504,7 @@ static int nb8800_probe(struct platform_device *pdev)
 err_free_dma:
 	nb8800_dma_free(dev);
 err_free_bus:
+	of_node_put(priv->phy_node);
 	mdiobus_unregister(bus);
 err_disable_clk:
 	clk_disable_unprepare(priv->clk);
@@ -1519,6 +1520,7 @@ static int nb8800_remove(struct platform_device *pdev)
 	struct nb8800_priv *priv = netdev_priv(ndev);
 
 	unregister_netdev(ndev);
+	of_node_put(priv->phy_node);
 
 	mdiobus_unregister(priv->mii_bus);
 
-- 
1.9.1

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

* [PATCH v2 05/15] ethernet: cavium: octeon: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (3 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 04/15] ethernet: aurora: nb8800: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 06/15] ethernet: hisilicon: hns: hns_dsaf_mac: " Peter Chen
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index e8bc15b..4ab404f 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1513,6 +1513,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
 	return 0;
 
 err:
+	of_node_put(p->phy_np);
 	free_netdev(netdev);
 	return result;
 }
@@ -1520,8 +1521,10 @@ err:
 static int octeon_mgmt_remove(struct platform_device *pdev)
 {
 	struct net_device *netdev = platform_get_drvdata(pdev);
+	struct octeon_mgmt *p = netdev_priv(netdev);
 
 	unregister_netdev(netdev);
+	of_node_put(p->phy_np);
 	free_netdev(netdev);
 	return 0;
 }
-- 
1.9.1

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

* [PATCH v2 06/15] ethernet: hisilicon: hns: hns_dsaf_mac: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (4 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 05/15] ethernet: cavium: octeon: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 07/15] ethernet: hisilicon: hns: hns_dsaf_main: " Peter Chen
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
index 3fb87e2..5c8afe1 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
@@ -795,6 +795,7 @@ static int  hns_mac_get_info(struct hns_mac_cb *mac_cb)
 			dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
 				mac_cb->mac_id, np->name);
 		}
+		of_node_put(np);
 
 		return 0;
 	}
@@ -812,10 +813,12 @@ static int  hns_mac_get_info(struct hns_mac_cb *mac_cb)
 			dev_dbg(mac_cb->dev, "mac%d phy_node: %s\n",
 				mac_cb->mac_id, np->name);
 		}
+		of_node_put(np);
 
-		syscon = syscon_node_to_regmap(
-				of_parse_phandle(to_of_node(mac_cb->fw_port),
-						 "serdes-syscon", 0));
+		np = of_parse_phandle(to_of_node(mac_cb->fw_port),
+					"serdes-syscon", 0);
+		syscon = syscon_node_to_regmap(np);
+		of_node_put(np);
 		if (IS_ERR_OR_NULL(syscon)) {
 			dev_err(mac_cb->dev, "serdes-syscon is needed!\n");
 			return -EINVAL;
-- 
1.9.1

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

* [PATCH v2 07/15] ethernet: hisilicon: hns: hns_dsaf_main: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (5 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 06/15] ethernet: hisilicon: hns: hns_dsaf_mac: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 08/15] ethernet: marvell: mvneta: " Peter Chen
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
index 2ef4277..afb5daa 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
@@ -51,7 +51,7 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
 	const char *mode_str;
 	struct regmap *syscon;
 	struct resource *res;
-	struct device_node *np = dsaf_dev->dev->of_node;
+	struct device_node *np = dsaf_dev->dev->of_node, *np_temp;
 	struct platform_device *pdev = to_platform_device(dsaf_dev->dev);
 
 	if (dev_of_node(dsaf_dev->dev)) {
@@ -102,8 +102,9 @@ int hns_dsaf_get_cfg(struct dsaf_device *dsaf_dev)
 		dsaf_dev->dsaf_tc_mode = HRD_DSAF_4TC_MODE;
 
 	if (dev_of_node(dsaf_dev->dev)) {
-		syscon = syscon_node_to_regmap(
-				of_parse_phandle(np, "subctrl-syscon", 0));
+		np_temp = of_parse_phandle(np, "subctrl-syscon", 0);
+		syscon = syscon_node_to_regmap(np_temp);
+		of_node_put(np_temp);
 		if (IS_ERR_OR_NULL(syscon)) {
 			res = platform_get_resource(pdev, IORESOURCE_MEM,
 						    res_idx++);
-- 
1.9.1

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

* [PATCH v2 08/15] ethernet: marvell: mvneta: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (6 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 07/15] ethernet: hisilicon: hns: hns_dsaf_main: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 09/15] ethernet: marvell: mvpp2: " Peter Chen
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index f92018b..d41c28d 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4118,6 +4118,7 @@ static int mvneta_probe(struct platform_device *pdev)
 			pp->bm_priv = NULL;
 		}
 	}
+	of_node_put(bm_node);
 
 	err = mvneta_init(&pdev->dev, pp);
 	if (err < 0)
-- 
1.9.1

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

* [PATCH v2 09/15] ethernet: marvell: mvpp2: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (7 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 08/15] ethernet: marvell: mvneta: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 10/15] ethernet: marvell: pxa168_eth: " Peter Chen
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 0b04717..60227a3 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -6234,6 +6234,7 @@ err_free_stats:
 err_free_irq:
 	irq_dispose_mapping(port->irq);
 err_free_netdev:
+	of_node_put(phy_node);
 	free_netdev(dev);
 	return err;
 }
@@ -6244,6 +6245,7 @@ static void mvpp2_port_remove(struct mvpp2_port *port)
 	int i;
 
 	unregister_netdev(port->dev);
+	of_node_put(port->phy_node);
 	free_percpu(port->pcpu);
 	free_percpu(port->stats);
 	for (i = 0; i < txq_number; i++)
-- 
1.9.1

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

* [PATCH v2 10/15] ethernet: marvell: pxa168_eth: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (8 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 09/15] ethernet: marvell: mvpp2: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 11/15] ethernet: renesas: ravb_main: " Peter Chen
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/marvell/pxa168_eth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index aeeb2e7..5d5000c 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1506,6 +1506,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 		}
 		of_property_read_u32(np, "reg", &pep->phy_addr);
 		pep->phy_intf = of_get_phy_mode(pdev->dev.of_node);
+		of_node_put(np);
 	}
 
 	/* Hardware supports only 3 ports */
-- 
1.9.1

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

* [PATCH v2 11/15] ethernet: renesas: ravb_main: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (9 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 10/15] ethernet: marvell: pxa168_eth: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 12/15] ethernet: renesas: sh_eth: " Peter Chen
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 8377d02..1e1cc0f 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1005,6 +1005,7 @@ static int ravb_phy_init(struct net_device *ndev)
 	}
 	phydev = of_phy_connect(ndev, pn, ravb_adjust_link, 0,
 				priv->phy_interface);
+	of_node_put(pn);
 	if (!phydev) {
 		netdev_err(ndev, "failed to connect PHY\n");
 		return -ENOENT;
-- 
1.9.1

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

* [PATCH v2 12/15] ethernet: renesas: sh_eth: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (10 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 11/15] ethernet: renesas: ravb_main: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 13/15] ethernet: stmicro: stmmac: dwmac-socfpga: " Peter Chen
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7bd910c..799d58d 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1780,6 +1780,7 @@ static int sh_eth_phy_init(struct net_device *ndev)
 					sh_eth_adjust_link, 0,
 					mdp->phy_interface);
 
+		of_node_put(pn);
 		if (!phydev)
 			phydev = ERR_PTR(-ENOENT);
 	} else {
-- 
1.9.1

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

* [PATCH v2 13/15] ethernet: stmicro: stmmac: dwmac-socfpga: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (11 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 12/15] ethernet: renesas: sh_eth: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:02 ` [PATCH v2 14/15] ethernet: stmicro: stmmac: " Peter Chen
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c    | 36 ++++++++++++++++------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index edd20c3..bec6963 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -135,7 +135,9 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
 
 	np_splitter = of_parse_phandle(np, "altr,emac-splitter", 0);
 	if (np_splitter) {
-		if (of_address_to_resource(np_splitter, 0, &res_splitter)) {
+		ret = of_address_to_resource(np_splitter, 0, &res_splitter);
+		of_node_put(np_splitter);
+		if (ret) {
 			dev_info(dev, "Missing emac splitter address\n");
 			return -EINVAL;
 		}
@@ -159,14 +161,17 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
 				dev_err(dev,
 					"%s: ERROR: missing emac splitter address\n",
 					__func__);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto err_node_put;
 			}
 
 			dwmac->splitter_base =
 			    devm_ioremap_resource(dev, &res_splitter);
 
-			if (IS_ERR(dwmac->splitter_base))
-				return PTR_ERR(dwmac->splitter_base);
+			if (IS_ERR(dwmac->splitter_base)) {
+				ret = PTR_ERR(dwmac->splitter_base);
+				goto err_node_put;
+			}
 		}
 
 		index = of_property_match_string(np_sgmii_adapter, "reg-names",
@@ -178,14 +183,17 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
 				dev_err(dev,
 					"%s: ERROR: failed mapping adapter\n",
 					__func__);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto err_node_put;
 			}
 
 			dwmac->pcs.sgmii_adapter_base =
 			    devm_ioremap_resource(dev, &res_sgmii_adapter);
 
-			if (IS_ERR(dwmac->pcs.sgmii_adapter_base))
-				return PTR_ERR(dwmac->pcs.sgmii_adapter_base);
+			if (IS_ERR(dwmac->pcs.sgmii_adapter_base)) {
+				ret = PTR_ERR(dwmac->pcs.sgmii_adapter_base);
+				goto err_node_put;
+			}
 		}
 
 		index = of_property_match_string(np_sgmii_adapter, "reg-names",
@@ -197,22 +205,30 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
 				dev_err(dev,
 					"%s: ERROR: failed mapping tse control port\n",
 					__func__);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto err_node_put;
 			}
 
 			dwmac->pcs.tse_pcs_base =
 			    devm_ioremap_resource(dev, &res_tse_pcs);
 
-			if (IS_ERR(dwmac->pcs.tse_pcs_base))
-				return PTR_ERR(dwmac->pcs.tse_pcs_base);
+			if (IS_ERR(dwmac->pcs.tse_pcs_base)) {
+				ret = PTR_ERR(dwmac->pcs.tse_pcs_base);
+				goto err_node_put;
+			}
 		}
 	}
 	dwmac->reg_offset = reg_offset;
 	dwmac->reg_shift = reg_shift;
 	dwmac->sys_mgr_base_addr = sys_mgr_base_addr;
 	dwmac->dev = dev;
+	of_node_put(np_sgmii_adapter);
 
 	return 0;
+
+err_node_put:
+	of_node_put(np_sgmii_adapter);
+	return ret;
 }
 
 static int socfpga_dwmac_set_phy_mode(struct socfpga_dwmac *dwmac)
-- 
1.9.1

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

* [PATCH v2 14/15] ethernet: stmicro: stmmac: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (12 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 13/15] ethernet: stmicro: stmmac: dwmac-socfpga: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  7:37   ` Alexandre Torgue
  2016-08-01  7:02 ` [PATCH v2 15/15] ethernet: ti: davinci_emac: " Peter Chen
  2016-08-02  5:14 ` [PATCH v2 00/15] " David Miller
  15 siblings, 1 reply; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

This commit fixes both local (in stmmac_axi_setup) and global
(plat->phy_node) device_node for this issue, and using the
correct device node when tries to put node at stmmac_probe_config_dt
for error path.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 1 +
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c23ccab..4c8c60a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3397,6 +3397,7 @@ int stmmac_dvr_remove(struct device *dev)
 	stmmac_set_mac(priv->ioaddr, false);
 	netif_carrier_off(ndev);
 	unregister_netdev(ndev);
+	of_node_put(priv->plat->phy_node);
 	if (priv->stmmac_rst)
 		reset_control_assert(priv->stmmac_rst);
 	clk_disable_unprepare(priv->pclk);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index f7dfc0a..756bb54 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -113,8 +113,10 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
 		return NULL;
 
 	axi = kzalloc(sizeof(*axi), GFP_KERNEL);
-	if (!axi)
+	if (!axi) {
+		of_node_put(np);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en");
 	axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm");
@@ -127,6 +129,7 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
 	of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt);
 	of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt);
 	of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN);
+	of_node_put(np);
 
 	return axi;
 }
@@ -302,7 +305,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
 		dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
 				       GFP_KERNEL);
 		if (!dma_cfg) {
-			of_node_put(np);
+			of_node_put(plat->phy_node);
 			return ERR_PTR(-ENOMEM);
 		}
 		plat->dma_cfg = dma_cfg;
-- 
1.9.1

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

* [PATCH v2 15/15] ethernet: ti: davinci_emac: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (13 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 14/15] ethernet: stmicro: stmmac: " Peter Chen
@ 2016-08-01  7:02 ` Peter Chen
  2016-08-01  8:28     ` Mugunthan V N
  2016-08-02  5:14 ` [PATCH v2 00/15] " David Miller
  15 siblings, 1 reply; 20+ messages in thread
From: Peter Chen @ 2016-08-01  7:02 UTC (permalink / raw)
  To: davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang, Peter Chen

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/net/ethernet/ti/davinci_emac.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index c6c5465..45ab9d4 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -2060,6 +2060,7 @@ static int davinci_emac_remove(struct platform_device *pdev)
 	cpdma_ctlr_destroy(priv->dma);
 
 	unregister_netdev(ndev);
+	of_node_put(priv->phy_node);
 	pm_runtime_disable(&pdev->dev);
 	free_netdev(ndev);
 
-- 
1.9.1

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

* Re: [PATCH v2 14/15] ethernet: stmicro: stmmac: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 ` [PATCH v2 14/15] ethernet: stmicro: stmmac: " Peter Chen
@ 2016-08-01  7:37   ` Alexandre Torgue
  0 siblings, 0 replies; 20+ messages in thread
From: Alexandre Torgue @ 2016-08-01  7:37 UTC (permalink / raw)
  To: Peter Chen, davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	mugunthanvnm, tremyfr, wxt, arnd, david.daney, huangdaode,
	jszhang

Hi,

On 08/01/2016 09:02 AM, Peter Chen wrote:
> of_node_put needs to be called when the device node which is got
> from of_parse_phandle has finished using.
>
> This commit fixes both local (in stmmac_axi_setup) and global
> (plat->phy_node) device_node for this issue, and using the
> correct device node when tries to put node at stmmac_probe_config_dt
> for error path.
>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 1 +
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index c23ccab..4c8c60a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -3397,6 +3397,7 @@ int stmmac_dvr_remove(struct device *dev)
>  	stmmac_set_mac(priv->ioaddr, false);
>  	netif_carrier_off(ndev);
>  	unregister_netdev(ndev);
> +	of_node_put(priv->plat->phy_node);
>  	if (priv->stmmac_rst)
>  		reset_control_assert(priv->stmmac_rst);
>  	clk_disable_unprepare(priv->pclk);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index f7dfc0a..756bb54 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -113,8 +113,10 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
>  		return NULL;
>
>  	axi = kzalloc(sizeof(*axi), GFP_KERNEL);
> -	if (!axi)
> +	if (!axi) {
> +		of_node_put(np);
>  		return ERR_PTR(-ENOMEM);
> +	}
>
>  	axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en");
>  	axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm");
> @@ -127,6 +129,7 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
>  	of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt);
>  	of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt);
>  	of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN);
> +	of_node_put(np);
>
>  	return axi;
>  }
> @@ -302,7 +305,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
>  		dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
>  				       GFP_KERNEL);
>  		if (!dma_cfg) {
> -			of_node_put(np);
> +			of_node_put(plat->phy_node);
>  			return ERR_PTR(-ENOMEM);
>  		}
>  		plat->dma_cfg = dma_cfg;
>

You can add my:

Acked-by: Alexandre Torgue <alexandre.torgue@st.com>

Regards

Alex

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

* Re: [PATCH v2 15/15] ethernet: ti: davinci_emac: add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 ` [PATCH v2 15/15] ethernet: ti: davinci_emac: " Peter Chen
@ 2016-08-01  8:28     ` Mugunthan V N
  0 siblings, 0 replies; 20+ messages in thread
From: Mugunthan V N @ 2016-08-01  8:28 UTC (permalink / raw)
  To: Peter Chen, davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, tremyfr, wxt, arnd, david.daney, huangdaode,
	jszhang, Linux OMAP Mailing List

+omap ML

On Monday 01 August 2016 12:32 PM, Peter Chen wrote:
> of_node_put needs to be called when the device node which is got
> from of_parse_phandle has finished using.
> 
> Signed-off-by: Peter Chen <peter.chen@nxp.com>

Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

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

* Re: [PATCH v2 15/15] ethernet: ti: davinci_emac: add missing of_node_put after calling of_parse_phandle
@ 2016-08-01  8:28     ` Mugunthan V N
  0 siblings, 0 replies; 20+ messages in thread
From: Mugunthan V N @ 2016-08-01  8:28 UTC (permalink / raw)
  To: Peter Chen, davem
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, tremyfr, wxt, arnd, david.daney, huangdaode,
	jszhang, Linux OMAP Mailing List

+omap ML

On Monday 01 August 2016 12:32 PM, Peter Chen wrote:
> of_node_put needs to be called when the device node which is got
> from of_parse_phandle has finished using.
> 
> Signed-off-by: Peter Chen <peter.chen@nxp.com>

Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

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

* Re: [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle
  2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
                   ` (14 preceding siblings ...)
  2016-08-01  7:02 ` [PATCH v2 15/15] ethernet: ti: davinci_emac: " Peter Chen
@ 2016-08-02  5:14 ` David Miller
  15 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2016-08-02  5:14 UTC (permalink / raw)
  To: peter.chen
  Cc: netdev, vbridger, isubramanian, kchudgar, yisen.zhuang,
	salil.mehta, thomas.petazzoni, sergei.shtylyov, peppe.cavallaro,
	alexandre.torgue, mugunthanvnm, tremyfr, wxt, arnd, david.daney,
	huangdaode, jszhang

From: Peter Chen <peter.chen@nxp.com>
Date: Mon, 1 Aug 2016 15:02:28 +0800

> This patch set fixes missing of_node_put issue at ethernet driver.
> of_node_put needs to be called when the device node which is got
> from of_parse_phandle has finished using.
> 
> The compilation test has passed by using allmodconfig for drivers/net/ethernet.
> 
> Thanks.
> 
> Changes for v2:
> - If the device node is local variable, it can be put in the same function.
> - If the device node will be used the whole driver life cycle,
>   it should be put (call of_node_put) at driver's remove. 
>   Patch [4, 5, 9, 14, 15/15]
> - Fix the issue that the node still be used at error patch [6/15]
> - Add acked for patch [11,12/15]

Series applied, thanks.

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

end of thread, other threads:[~2016-08-02  5:26 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-01  7:02 [PATCH v2 00/15] add missing of_node_put after calling of_parse_phandle Peter Chen
2016-08-01  7:02 ` [PATCH v2 01/15] ethernet: altera: add missing of_node_put Peter Chen
2016-08-01  7:02 ` [PATCH v2 02/15] ethernet: apm: xgene: add missing of_node_put after calling of_parse_phandle Peter Chen
2016-08-01  7:02 ` [PATCH v2 03/15] ethernet: arc: emac_main: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 04/15] ethernet: aurora: nb8800: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 05/15] ethernet: cavium: octeon: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 06/15] ethernet: hisilicon: hns: hns_dsaf_mac: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 07/15] ethernet: hisilicon: hns: hns_dsaf_main: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 08/15] ethernet: marvell: mvneta: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 09/15] ethernet: marvell: mvpp2: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 10/15] ethernet: marvell: pxa168_eth: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 11/15] ethernet: renesas: ravb_main: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 12/15] ethernet: renesas: sh_eth: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 13/15] ethernet: stmicro: stmmac: dwmac-socfpga: " Peter Chen
2016-08-01  7:02 ` [PATCH v2 14/15] ethernet: stmicro: stmmac: " Peter Chen
2016-08-01  7:37   ` Alexandre Torgue
2016-08-01  7:02 ` [PATCH v2 15/15] ethernet: ti: davinci_emac: " Peter Chen
2016-08-01  8:28   ` Mugunthan V N
2016-08-01  8:28     ` Mugunthan V N
2016-08-02  5:14 ` [PATCH v2 00/15] " David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.