2018-06-11 13:05:24

by Yue Haibing

[permalink] [raw]
Subject: [PATCH net] net: qcom/emac: Add missing of_node_put()

Add missing of_node_put() call for device node returned by
of_parse_phandle().

Signed-off-by: YueHaibing <[email protected]>
---
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
index e78e5db..c694e34 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
@@ -384,6 +384,7 @@ int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
}

sgmii_pdev = of_find_device_by_node(np);
+ of_node_put(np);
if (!sgmii_pdev) {
dev_err(&pdev->dev, "invalid internal-phy property\n");
return -ENODEV;
--
2.7.0




2018-06-12 02:23:49

by Timur Tabi

[permalink] [raw]
Subject: Re: [PATCH net] net: qcom/emac: Add missing of_node_put()

On 6/11/18 8:03 AM, YueHaibing wrote:
> Add missing of_node_put() call for device node returned by
> of_parse_phandle().

Hmmmm... This shouldn't be necessary. I was very careful with calls to
of_node_put(). Give me a day or two to confirm, please.

--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

2018-06-13 20:45:49

by Timur Tabi

[permalink] [raw]
Subject: Re: [PATCH net] net: qcom/emac: Add missing of_node_put()

On 06/11/2018 08:03 AM, YueHaibing wrote:
> Add missing of_node_put() call for device node returned by
> of_parse_phandle().
>
> Signed-off-by: YueHaibing<[email protected]>

Acked-by: Timur Tabi <[email protected]>

This seems legit. The comment for of_find_device_by_node() that says
the np needs to be released was added after the code was written, so
it's possible that I didn't know at the time that this was a requirement.

However, I no longer have the ability to test EMAC on device tree
platforms, so I can't verify this code.

--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

2018-06-15 00:02:17

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net] net: qcom/emac: Add missing of_node_put()

From: YueHaibing <[email protected]>
Date: Mon, 11 Jun 2018 21:03:45 +0800

> Add missing of_node_put() call for device node returned by
> of_parse_phandle().
>
> Signed-off-by: YueHaibing <[email protected]>

Applied, thank you.