diff options
author | Johan Hovold <johan@kernel.org> | 2017-01-02 06:56:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-03 09:33:00 -0500 |
commit | 8f87e626b059f1b82b017f53c5ee91fbc4486e36 (patch) | |
tree | 21d46677a891982becb2451e913327215c8629c4 | |
parent | 4e5da369df64628358e25ffedcf80ac43af3793d (diff) |
net: stmmac: dwmac-oxnas: fix of-node leak
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@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 10 |
1 files 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) | |||
109 | { | 109 | { |
110 | struct plat_stmmacenet_data *plat_dat; | 110 | struct plat_stmmacenet_data *plat_dat; |
111 | struct stmmac_resources stmmac_res; | 111 | struct stmmac_resources stmmac_res; |
112 | struct device_node *sysctrl; | ||
113 | struct oxnas_dwmac *dwmac; | 112 | struct oxnas_dwmac *dwmac; |
114 | int ret; | 113 | int ret; |
115 | 114 | ||
116 | sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0); | ||
117 | if (!sysctrl) { | ||
118 | dev_err(&pdev->dev, "failed to get sys-ctrl node\n"); | ||
119 | return -EINVAL; | ||
120 | } | ||
121 | |||
122 | ret = stmmac_get_platform_resources(pdev, &stmmac_res); | 115 | ret = stmmac_get_platform_resources(pdev, &stmmac_res); |
123 | if (ret) | 116 | if (ret) |
124 | return ret; | 117 | return ret; |
@@ -134,7 +127,8 @@ static int oxnas_dwmac_probe(struct platform_device *pdev) | |||
134 | dwmac->dev = &pdev->dev; | 127 | dwmac->dev = &pdev->dev; |
135 | plat_dat->bsp_priv = dwmac; | 128 | plat_dat->bsp_priv = dwmac; |
136 | 129 | ||
137 | dwmac->regmap = syscon_node_to_regmap(sysctrl); | 130 | dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
131 | "oxsemi,sys-ctrl"); | ||
138 | if (IS_ERR(dwmac->regmap)) { | 132 | if (IS_ERR(dwmac->regmap)) { |
139 | dev_err(&pdev->dev, "failed to have sysctrl regmap\n"); | 133 | dev_err(&pdev->dev, "failed to have sysctrl regmap\n"); |
140 | return PTR_ERR(dwmac->regmap); | 134 | return PTR_ERR(dwmac->regmap); |