Skip to contentSkip to conversation

add missing of_node_put after calling of_parse_phandle (1st)

PATCH In review Peter Chen 8 participants 24 messages Jul 1, 2016 – Jul 11, 2016 2 messages not in the archive

Subsystems (8)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

cover add missing of_node_put after calling of_parse_phandle (1st)

Hi all,

of_node_put needs to be called when the device node which is got from of_parse_phandle has finished using, but there are many codes do not follow that, this patch set fixes some of them.

Peter Chen (7):
extcon: add missing of_node_put after calling of_parse_phandle
arm: mach-shmobile: pm-rmobile: add missing of_node_put after calling
of_parse_phandle
arm: mach-u300: regulator: add missing of_node_put after calling
of_parse_phandle
bus: arm-cci: add missing of_node_put after calling of_parse_phandle
bus: vexpress-config: add missing of_node_put after calling
of_parse_phandle
devfreq: add missing of_node_put after calling of_parse_phandle
devfreq: exynos-bus: add missing of_node_put after calling
of_parse_phandle

 arch/arm/mach-shmobile/pm-rmobile.c |  1 +
 arch/arm/mach-u300/regulator.c      | 12 +++++++++---
 drivers/bus/arm-cci.c               |  5 ++++-
 drivers/bus/vexpress-config.c       |  1 +
 drivers/devfreq/devfreq.c           |  2 ++
 drivers/devfreq/exynos-bus.c        |  9 ++++++---
 drivers/extcon/extcon.c             |  2 ++
 7 files changed, 25 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/7 extcon: 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 MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
---
 drivers/extcon/extcon.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/extcon/extcon.c +2 -0
index 21a123c..86ea14d 100644
@@ -1107,10 +1107,12 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
 	list_for_each_entry(edev, &extcon_dev_list, entry) {
 		if (edev->dev.parent && edev->dev.parent->of_node == node) {
 			mutex_unlock(&extcon_dev_list_lock);
+			of_node_put(node);
 			return edev;
 		}
 	}
 	mutex_unlock(&extcon_dev_list_lock);
+	of_node_put(node);
 
 	return ERR_PTR(-EPROBE_DEFER);
 }
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 2/7 arm: mach-shmobile: pm-rmobile: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
---
 arch/arm/mach-shmobile/pm-rmobile.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-shmobile/pm-rmobile.c +1 -0
index c0b05e9..8eb2cb6 100644
@@ -209,6 +209,7 @@ static void __init add_special_pd(struct device_node *np, enum pd_types type)
 	special_pds[num_special_pds].pd = pd;
 	special_pds[num_special_pds].type = type;
 	num_special_pds++;
+	of_node_put(pd);
 }
 
 static void __init get_special_pds(void)
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH 3/7 arm: mach-u300: regulator: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Linus Walleij <[email protected]>
---
 arch/arm/mach-u300/regulator.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-u300/regulator.c +9 -3
index 595b574..509643e 100644
@@ -71,19 +71,21 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	regmap = syscon_node_to_regmap(syscon_np);
 	if (IS_ERR(regmap)) {
 		pr_crit("U300: could not locate syscon regmap\n");
-		return PTR_ERR(regmap);
+		err = PTR_ERR(regmap);
+		goto error;
 	}
 
 	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
 		pr_err("could not get vana15");
-		return PTR_ERR(main_power_15);
+		err = PTR_ERR(main_power_15);
+		goto error;
 	}
 	err = regulator_enable(main_power_15);
 	if (err) {
 		pr_err("could not enable vana15\n");
-		return err;
+		goto error;
 	}
 
 	/*
@@ -99,8 +101,12 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 
 	/* Register globally exported PM poweroff hook */
 	pm_power_off = u300_pm_poweroff;
+	of_node_put(syscon_np);
 
 	return 0;
+error:
+	of_node_put(syscon_np);
+	return err;
 }
 
 static int __init s365_board_probe(struct platform_device *pdev)
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH 3/7 arm: mach-u300: regulator: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Linus Walleij <[email protected]>
---
 arch/arm/mach-u300/regulator.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-u300/regulator.c +9 -3
index 595b574..509643e 100644
@@ -71,19 +71,21 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	regmap = syscon_node_to_regmap(syscon_np);
 	if (IS_ERR(regmap)) {
 		pr_crit("U300: could not locate syscon regmap\n");
-		return PTR_ERR(regmap);
+		err = PTR_ERR(regmap);
+		goto error;
 	}
 
 	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
 		pr_err("could not get vana15");
-		return PTR_ERR(main_power_15);
+		err = PTR_ERR(main_power_15);
+		goto error;
 	}
 	err = regulator_enable(main_power_15);
 	if (err) {
 		pr_err("could not enable vana15\n");
-		return err;
+		goto error;
 	}
 
 	/*
@@ -99,8 +101,12 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 
 	/* Register globally exported PM poweroff hook */
 	pm_power_off = u300_pm_poweroff;
+	of_node_put(syscon_np);
 
 	return 0;
+error:
+	of_node_put(syscon_np);
+	return err;
 }
 
 static int __init s365_board_probe(struct platform_device *pdev)
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH 3/7 arm: mach-u300: regulator: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Linus Walleij <[email protected]>
---
 arch/arm/mach-u300/regulator.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-u300/regulator.c +9 -3
index 595b574..509643e 100644
@@ -71,19 +71,21 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	regmap = syscon_node_to_regmap(syscon_np);
 	if (IS_ERR(regmap)) {
 		pr_crit("U300: could not locate syscon regmap\n");
-		return PTR_ERR(regmap);
+		err = PTR_ERR(regmap);
+		goto error;
 	}
 
 	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
 		pr_err("could not get vana15");
-		return PTR_ERR(main_power_15);
+		err = PTR_ERR(main_power_15);
+		goto error;
 	}
 	err = regulator_enable(main_power_15);
 	if (err) {
 		pr_err("could not enable vana15\n");
-		return err;
+		goto error;
 	}
 
 	/*
@@ -99,8 +101,12 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 
 	/* Register globally exported PM poweroff hook */
 	pm_power_off = u300_pm_poweroff;
+	of_node_put(syscon_np);
 
 	return 0;
+error:
+	of_node_put(syscon_np);
+	return err;
 }
 
 static int __init s365_board_probe(struct platform_device *pdev)
Signature · 1 line
1.9.1
author
#10 lore raw

PATCH 3/7 arm: mach-u300: regulator: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Linus Walleij <[email protected]>
---
 arch/arm/mach-u300/regulator.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-u300/regulator.c +9 -3
index 595b574..509643e 100644
@@ -71,19 +71,21 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	regmap = syscon_node_to_regmap(syscon_np);
 	if (IS_ERR(regmap)) {
 		pr_crit("U300: could not locate syscon regmap\n");
-		return PTR_ERR(regmap);
+		err = PTR_ERR(regmap);
+		goto error;
 	}
 
 	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
 		pr_err("could not get vana15");
-		return PTR_ERR(main_power_15);
+		err = PTR_ERR(main_power_15);
+		goto error;
 	}
 	err = regulator_enable(main_power_15);
 	if (err) {
 		pr_err("could not enable vana15\n");
-		return err;
+		goto error;
 	}
 
 	/*
@@ -99,8 +101,12 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 
 	/* Register globally exported PM poweroff hook */
 	pm_power_off = u300_pm_poweroff;
+	of_node_put(syscon_np);
 
 	return 0;
+error:
+	of_node_put(syscon_np);
+	return err;
 }
 
 static int __init s365_board_probe(struct platform_device *pdev)
Signature · 1 line
1.9.1
author
#11 lore raw

PATCH 3/7 arm: mach-u300: regulator: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Linus Walleij <[email protected]>
---
 arch/arm/mach-u300/regulator.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm/mach-u300/regulator.c +9 -3
index 595b574..509643e 100644
@@ -71,19 +71,21 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 	regmap = syscon_node_to_regmap(syscon_np);
 	if (IS_ERR(regmap)) {
 		pr_crit("U300: could not locate syscon regmap\n");
-		return PTR_ERR(regmap);
+		err = PTR_ERR(regmap);
+		goto error;
 	}
 
 	main_power_15 = regulator_get(&pdev->dev, "vana15");
 
 	if (IS_ERR(main_power_15)) {
 		pr_err("could not get vana15");
-		return PTR_ERR(main_power_15);
+		err = PTR_ERR(main_power_15);
+		goto error;
 	}
 	err = regulator_enable(main_power_15);
 	if (err) {
 		pr_err("could not enable vana15\n");
-		return err;
+		goto error;
 	}
 
 	/*
@@ -99,8 +101,12 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 
 	/* Register globally exported PM poweroff hook */
 	pm_power_off = u300_pm_poweroff;
+	of_node_put(syscon_np);
 
 	return 0;
+error:
+	of_node_put(syscon_np);
+	return err;
 }
 
 static int __init s365_board_probe(struct platform_device *pdev)
Signature · 1 line
1.9.1
author
#12 lore raw

PATCH 4/7 bus: arm-cci: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Will Deacon <[email protected]>
Cc Suzuki K Poulose <[email protected]>
---
 drivers/bus/arm-cci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bus/arm-cci.c +4 -1
index a49b283..e7b0b8c 100644
@@ -1912,9 +1912,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
 	cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
 	for (i = 0; i < nb_cci_ports; i++) {
 		ace_match = ports[i].type == type;
-		if (ace_match && cci_portn == ports[i].dn)
+		if (ace_match && cci_portn == ports[i].dn) {
+			of_node_put(cci_portn);
 			return i;
+		}
 	}
+	of_node_put(cci_portn);
 	return -ENODEV;
 }
 
Signature · 1 line
1.9.1
author
#17 lore raw

PATCH 5/7 bus: vexpress-config: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc Liviu Dudau <[email protected]>
Cc Sudeep Holla <[email protected]>
Cc Lorenzo Pieralisi <[email protected]>
---
 drivers/bus/vexpress-config.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bus/vexpress-config.c +1 -0
index c3cb76b..9efdf1d 100644
@@ -178,6 +178,7 @@ static int vexpress_config_populate(struct device_node *node)
 
 	parent = class_find_device(vexpress_config_class, NULL, bridge,
 			vexpress_config_node_match);
+	of_node_put(bridge);
 	if (WARN_ON(!parent))
 		return -ENODEV;
 
Signature · 1 line
1.9.1
author
#19 lore raw

PATCH 6/7 devfreq: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

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

Cc MyungJoo Ham <[email protected]>
Cc Kyungmin Park <[email protected]>
---
 drivers/devfreq/devfreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/devfreq/devfreq.c +2 -0
index 1d6c803..3f2142f 100644
@@ -706,10 +706,12 @@ struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
 		if (devfreq->dev.parent
 			&& devfreq->dev.parent->of_node == node) {
 			mutex_unlock(&devfreq_list_lock);
+			of_node_put(node);
 			return devfreq;
 		}
 	}
 	mutex_unlock(&devfreq_list_lock);
+	of_node_put(node);
 
 	return ERR_PTR(-EPROBE_DEFER);
 }
Signature · 1 line
1.9.1
author
#20 lore raw

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

In reply to 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]>
---
 drivers/devfreq/exynos-bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/devfreq/exynos-bus.c +6 -3
index 2363d0a..a38b5ec 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 *np = dev->of_node, 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
Reviewed-by on v1 4/7
#13 lore raw

Re: [PATCH 4/7] bus: arm-cci: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen
Quoted 6 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 Will Deacon <[email protected]>
Cc Suzuki K Poulose <[email protected]>

Thanks for the fix.

Quoted 9 lines
---
  drivers/bus/arm-cci.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bus/arm-cci.c +0 -0
index a49b283..e7b0b8c 100644

drivers/bus/arm-cci.c static int __cci_ace_get_port(struct device_node *dn, int type) · line 1920

Quoted 10 lines
drivers/bus/arm-cci.c +4 -1
@@ -1912,9 +1912,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
  	cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
  	for (i = 0; i < nb_cci_ports; i++) {
  		ace_match = ports[i].type == type;
-		if (ace_match && cci_portn == ports[i].dn)
+		if (ace_match && cci_portn == ports[i].dn) {
+			of_node_put(cci_portn);
  			return i;
+		}
  	}
+	of_node_put(cci_portn);

nit: Could we please do some thing like this ?

		if (ace_match && cci_portn == ports[i].dn)
			break;
	}

	of_node_put(cci_portn);
	return (i < nb_cci_ports) ? i : -ENODEV ;

Either way,

#14 lore raw

Re: [PATCH 4/7] bus: arm-cci: add missing of_node_put after calling of_parse_phandle

Quoted 38 lines · Suzuki K Poulose
Quoted 6 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 Will Deacon <[email protected]>
Cc Suzuki K Poulose <[email protected]>

Thanks for the fix.

Quoted 9 lines
---
 drivers/bus/arm-cci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bus/arm-cci.c +0 -0
index a49b283..e7b0b8c 100644

drivers/bus/arm-cci.c static int __cci_ace_get_port(struct device_node *dn, int type) · line 1920

Quoted 10 lines
drivers/bus/arm-cci.c +4 -1
@@ -1912,9 +1912,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type)
 	cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
 	for (i = 0; i < nb_cci_ports; i++) {
 		ace_match = ports[i].type == type;
-		if (ace_match && cci_portn == ports[i].dn)
+		if (ace_match && cci_portn == ports[i].dn) {
+			of_node_put(cci_portn);
 			return i;
+		}
 	}
+	of_node_put(cci_portn);

nit: Could we please do some thing like this ?

		if (ace_match && cci_portn == ports[i].dn)
			break;
	}

	of_node_put(cci_portn);
	return (i < nb_cci_ports) ? i : -ENODEV ;
Quoted 3 lines

Either way,

Please route this via arm-soc once you've addressed Suzuki's comment.

Will

#4 lore raw

Re: [PATCH 2/7] arm: mach-shmobile: pm-rmobile: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

Hi Peter,

Quoted 6 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 Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>

arch/arm/mach-shmobile/pm-rmobile.c static void __init add_special_pd(struct device_node *np, enum pd_types type) · line 209

Quoted 4 lines
arch/arm/mach-shmobile/pm-rmobile.c +0 -0
@@ -209,6 +209,7 @@ static void __init add_special_pd(struct device_node *np, enum pd_types type)
        special_pds[num_special_pds].pd = pd;

The pd pointer is stored in the line above, and released later in put_special_pds().

arch/arm/mach-shmobile/pm-rmobile.c static void __init add_special_pd(struct device_node *np, enum pd_types type) · line 212

Quoted 3 lines
arch/arm/mach-shmobile/pm-rmobile.c +1 -0
        special_pds[num_special_pds].type = type;
        num_special_pds++;
+       of_node_put(pd);

Hence it must not be released here, as that would cause a double release when put_special_pds() is executed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw

Re: [PATCH 1/7] extcon: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

Hi Peter,

Applied it.

Regards,
Chanwoo Choi

2016-07-01 18:41 GMT+09:00 Peter Chen <[email protected]>:

Quoted 35 lines

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

Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
---
 drivers/extcon/extcon.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/extcon/extcon.c +2 -1
index 21a123c..86ea14d 100644
@@ -1107,10 +1107,12 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
        list_for_each_entry(edev, &extcon_dev_list, entry) {
                if (edev->dev.parent && edev->dev.parent->of_node == node) {
                        mutex_unlock(&extcon_dev_list_lock);
+                       of_node_put(node);
                        return edev;
                }
        }
        mutex_unlock(&extcon_dev_list_lock);
+       of_node_put(node);
 
        return ERR_PTR(-EPROBE_DEFER);
 }
--

1.9.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Acked-by on v1 7/7
#21 lore raw

Re: [PATCH 7/7] devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen

Hi Peter,

2016-07-01 18:42 GMT+09:00 Peter Chen <[email protected]>:

Quoted 32 lines

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]>
---
 drivers/devfreq/exynos-bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/devfreq/exynos-bus.c +2 -2
index 2363d0a..a38b5ec 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 *np = dev->of_node, 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;

Regards,
Chanwoo Choi

author
#5 lore raw

RE: [PATCH 2/7] arm: mach-shmobile: pm-rmobile: add missing of_node_put after calling of_parse_phandle

In reply to Geert Uytterhoeven
Quoted 17 lines · Peter Chen
Quoted 6 lines

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

Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>

arch/arm/mach-shmobile/pm-rmobile.c static void __init add_special_pd(struct device_node *np,

Quoted 3 lines
arch/arm/mach-shmobile/pm-rmobile.c +0 -0
@@ -209,6 +209,7 @@ static void __init add_special_pd(struct device_node *np,

enum pd_types type)

arch/arm/mach-shmobile/pm-rmobile.c static void __init add_special_pd(struct device_node *np, enum pd_types type) · line 209

Quoted 1 line
arch/arm/mach-shmobile/pm-rmobile.c +0 -0
        special_pds[num_special_pds].pd = pd;
Quoted 9 lines

The pd pointer is stored in the line above, and released later in put_special_pds().

arch/arm/mach-shmobile/pm-rmobile.c static void __init add_special_pd(struct device_node *np, enum pd_types type) · line 212

Quoted 3 lines
arch/arm/mach-shmobile/pm-rmobile.c +1 -0
        special_pds[num_special_pds].type = type;
        num_special_pds++;
+       of_node_put(pd);

Hence it must not be released here, as that would cause a double release when put_special_pds() is executed.

Thanks, Geert, it is my careless.

Please forget this patch.

Peter

author
#15 lore raw

RE: [PATCH 4/7] bus: arm-cci: add missing of_node_put after calling of_parse_phandle

In reply to Will Deacon
Quoted 39 lines · Suzuki K Poulose
Quoted 14 lines · Peter Chen
Quoted 6 lines

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

Cc Will Deacon <[email protected]>
Cc Suzuki K Poulose <[email protected]>

Thanks for the fix.

Quoted 4 lines
---
 drivers/bus/arm-cci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 5 lines

drivers/bus/arm-cci.c static int __cci_ace_get_port(struct device_node *dn,

Quoted 5 lines
drivers/bus/arm-cci.c index renamed from drivers/bus/arm-cci.c +0 -0

a49b283..e7b0b8c 100644

drivers/bus/arm-cci.c +0 -0
@@ -1912,9 +1912,12 @@ static int __cci_ace_get_port(struct device_node *dn,

int type)

Quoted 16 lines

drivers/bus/arm-cci.c static int __cci_ace_get_port(struct device_node *dn, int type) · line 1920

Quoted 10 lines
drivers/bus/arm-cci.c +4 -1
 	cci_portn = of_parse_phandle(dn, "cci-control-port", 0);
 	for (i = 0; i < nb_cci_ports; i++) {
 		ace_match = ports[i].type == type;
-		if (ace_match && cci_portn == ports[i].dn)
+		if (ace_match && cci_portn == ports[i].dn) {
+			of_node_put(cci_portn);
 			return i;
+		}
 	}
+	of_node_put(cci_portn);

nit: Could we please do some thing like this ?

		if (ace_match && cci_portn == ports[i].dn)
			break;
	}
Quoted 9 lines
Quoted 6 lines
	of_node_put(cci_portn);
	return (i < nb_cci_ports) ? i : -ENODEV ;

Either way,

Please route this via arm-soc once you've addressed Suzuki's comment.

Hi Will, how to route patch via arm-soc?

Does it mean sending patch by adding arm at kernel.org at To or Cc list?

Peter

#16 lore raw

Re: [PATCH 4/7] bus: arm-cci: add missing of_node_put after calling of_parse_phandle

Quoted 5 lines · Peter Chen
Quoted 1 line

Please route this via arm-soc once you've addressed Suzuki's comment.

Hi Will, how to route patch via arm-soc?

Does it mean sending patch by adding arm at kernel.org at To or Cc list?

Yes. I just wanted to make it clear that I don't intend to pick this up (since I'd just send it to arm-soc anyway!).

Will

maintainer
#23 lore raw

RE: [PATCH 6/7] devfreq: add missing of_node_put after calling of_parse_phandle

In reply to a message not in the archive
Quoted 11 lines

--------- Original Message ---------
Sender : Peter Chen <[email protected]>
Date : 2016-07-01 18:49 (GMT+9)
Title : [PATCH 6/7] devfreq: 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 MyungJoo Ham <[email protected]>
Cc Kyungmin Park <[email protected]>

Thank you!

maintainer
#25 lore raw

RE: [PATCH 7/7] devfreq: exynos-bus: add missing of_node_put after calling of_parse_phandle

In reply to a message not in the archive
Quoted 9 lines

--------- Original Message ---------
Sender : Peter Chen <[email protected]>
Date : 2016-07-01 18:49 (GMT+9)
Title : [PATCH 7/7] 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.

Quoted 6 lines
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]>

With the change (build error fix) of the following added, (I'll update)

Cheers,
MyungJoo

Quoted 9 lines
---
 drivers/devfreq/exynos-bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/devfreq/exynos-bus.c +0 -0
index 2363d0a..a38b5ec 100644

drivers/devfreq/exynos-bus.c err_clk: · line 386

Quoted 5 lines
drivers/devfreq/exynos-bus.c +1 -1
@@ -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 *np = dev->of_node, node;

+ struct device_node *np = dev->of_node, *node;

Quoted 3 lines
drivers/devfreq/exynos-bus.c +0 -0
         struct devfreq_dev_profile *profile;
         struct devfreq_simple_ondemand_data *ondemand_data;
         struct devfreq_passive_data *passive_data;

...

maintainer Acked-by on v1 5/7
#18 lore raw

Re: [PATCH 5/7] bus: vexpress-config: add missing of_node_put after calling of_parse_phandle

In reply to Peter Chen
Quoted 7 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 Liviu Dudau <[email protected]>
Cc Sudeep Holla <[email protected]>
Cc Lorenzo Pieralisi <[email protected]>
Quoted 25 lines
---
 drivers/bus/vexpress-config.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bus/vexpress-config.c +1 -0
index c3cb76b..9efdf1d 100644
@@ -178,6 +178,7 @@ static int vexpress_config_populate(struct device_node *node)
 
 	parent = class_find_device(vexpress_config_class, NULL, bridge,
 			vexpress_config_node_match);
+	of_node_put(bridge);
 	if (WARN_ON(!parent))
 		return -ENODEV;
 
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 8 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ?\_(?)_/?