Skip to contentSkip to conversation

devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle

PATCH Superseded Peter Chen 2 participants 2 messages Jul 4, 2016

Subsystems (3)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

PATCH v2 1/1 devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle

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

Cc Chanwoo Choi <[email protected]>
Cc MyungJoo Ham <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>

---

Changes at v2:
- It should define node as pointer, kbuild test robot reports it

 drivers/devfreq/exynos-bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/devfreq/exynos-bus.c +6 -3
index 2363d0a..4b4c63c 100644
@@ -383,7 +383,7 @@ err_clk:
 static int exynos_bus_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
+	struct device_node *node, *np = dev->of_node;
 	struct devfreq_dev_profile *profile;
 	struct devfreq_simple_ondemand_data *ondemand_data;
 	struct devfreq_passive_data *passive_data;
@@ -415,10 +415,13 @@ static int exynos_bus_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	if (of_parse_phandle(dev->of_node, "devfreq", 0))
+	node = of_parse_phandle(dev->of_node, "devfreq", 0);
+	if (node) {
+		of_node_put(node);
 		goto passive;
-	else
+	} else {
 		ret = exynos_bus_parent_parse_of(np, bus);
+	}
 
 	if (ret < 0)
 		goto err;
Signature · 1 line
1.9.1
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 38 lines · Peter Chen

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

Cc Chanwoo Choi <[email protected]>
Cc MyungJoo Ham <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>

---

Changes at v2:
- It should define node as pointer, kbuild test robot reports it

 drivers/devfreq/exynos-bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/devfreq/exynos-bus.c +2 -2
index 2363d0a..4b4c63c 100644
@@ -383,7 +383,7 @@ err_clk:
 static int exynos_bus_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
+	struct device_node *node, *np = dev->of_node;
 	struct devfreq_dev_profile *profile;
 	struct devfreq_simple_ondemand_data *ondemand_data;
 	struct devfreq_passive_data *passive_data;
@@ -415,10 +415,13 @@ static int exynos_bus_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	if (of_parse_phandle(dev->of_node, "devfreq", 0))
+	node = of_parse_phandle(dev->of_node, "devfreq", 0);

drivers/devfreq/exynos-bus.c static int exynos_bus_probe(struct platform_device *pdev) · line 427

Quoted 10 lines
drivers/devfreq/exynos-bus.c +4 -1
+	if (node) {
+		of_node_put(node);
 		goto passive;
-	else
+	} else {
 		ret = exynos_bus_parent_parse_of(np, bus);
+	}
 
 	if (ret < 0)
 		goto err;

Thanks,
Chanwoo Choi