[linux-oxnas] [PATCH net 1/3] net: stmmac: dwmac-oxnas: fix of-node leak |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/linux-oxnas Archives
]
- To: "David S. Miller" <davem@xxxxxxxxxxxxx>
- Subject: [linux-oxnas] [PATCH net 1/3] net: stmmac: dwmac-oxnas: fix of-node leak
- From: Johan Hovold <johan@xxxxxxxxxx>
- Date: Mon, 2 Jan 2017 12:56:02 +0100
- Cc: Giuseppe Cavallaro <peppe.cavallaro@xxxxxx>, Alexandre Torgue <alexandre.torgue@xxxxxx>, Neil Armstrong <narmstrong@xxxxxxxxxxxx>, netdev@xxxxxxxxxxxxxxx, linux-oxnas@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Johan Hovold <johan@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1Aw8pPwuy7lw259otKyaFzYLFIWKBi7B3P7YCQBzhN8=; b=MdXpXAX1hiE8yLyxR19GNotE63cQXqKeuvAVKDoVXiV7ppmkDJWQjFzz+G/Zp/XdKT cHEspMWnsqLATr90BUzqlDowNDBCCN/BXETMbk/SnZqgzu4W2+9tHuhsJ8BgWkIaBmKP wlFSVa8FyAwuOZ8iHRqhl6udqFqLjDVW8ZXrBc6+2Gk1LauX89EX0UT460hdadejCo4f BeP0mDNT2nvya1h1h3Q1KkTBwo2WVoobWtxPpkwRN9dpJ7cOzAbJ/KYVh0iHW2MFYqj8 ib4vhtWnH0FgYgM8efzBuDh3xy6nF+nJdLch9bkfVoLCwMEY0ewjsv3fDKUde1jVt/65 Rw9g==
Use the syscon lookup-by-phandle helper so that the reference taken by
of_parse_phandle() is released when done with the node.
Fixes: 5ed7414062e7 ("net: stmmac: Add OXNAS Glue Driver")
Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
index c35597586121..fcc237e0aae1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
@@ -109,16 +109,9 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res;
- struct device_node *sysctrl;
struct oxnas_dwmac *dwmac;
int ret;
- sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0);
- if (!sysctrl) {
- dev_err(&pdev->dev, "failed to get sys-ctrl node\n");
- return -EINVAL;
- }
-
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret)
return ret;
@@ -134,7 +127,8 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
dwmac->dev = &pdev->dev;
plat_dat->bsp_priv = dwmac;
- dwmac->regmap = syscon_node_to_regmap(sysctrl);
+ dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+ "oxsemi,sys-ctrl");
if (IS_ERR(dwmac->regmap)) {
dev_err(&pdev->dev, "failed to have sysctrl regmap\n");
return PTR_ERR(dwmac->regmap);
--
2.10.2