Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] drivers: hwmon: fix device_node_continue.cocci warnings
@ 2017-01-10  5:48 Julia Lawall
  0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2017-01-10  5:48 UTC (permalink / raw)
  To: Jaghathiswari Rankappagounder Natarajan
  Cc: openbmc, joel, jdelvare, linux, linux-hwmon, linux-kernel, corbet,
	linux-doc, robh+dt, mark.rutland, devicetree, kbuild-all

Device node iterators put the previous value of the index variable, so an
explicit put causes a double put.

Generated by: scripts/coccinelle/iterators/device_node_continue.cocci

CC: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

The patch would not be needed if aspeed_create_type etc perform a second
get, beyond the one in the iterator.

 aspeed-pwm-tacho.c |    3 ---
 1 file changed, 3 deletions(-)

--- a/drivers/hwmon/aspeed-pwm-tacho.c
+++ b/drivers/hwmon/aspeed-pwm-tacho.c
@@ -833,21 +833,18 @@ static int aspeed_pwm_tacho_probe(struct
 	type_np = of_get_child_by_name(np, "type_values");
 	for_each_child_of_node(type_np, child) {
 		aspeed_create_type(child, priv, type_index++);
-		of_node_put(child);
 	}
 	of_node_put(type_np);
 	pwm_np = of_get_child_by_name(np, "pwm_port");
 	for_each_child_of_node(pwm_np, child) {
 		aspeed_create_pwm_port(child, priv, pwm_index++,
 				       group_index++);
-		of_node_put(child);
 	}
 	of_node_put(pwm_np);
 	fan_tach_np = of_get_child_by_name(np, "fan_tach_channel");
 	for_each_child_of_node(fan_tach_np, child) {
 		aspeed_create_fan_tach_channel(&pdev->dev, child, priv,
 					       fan_index++, group_index++);
-		of_node_put(child);
 	}
 	of_node_put(fan_tach_np);
 	of_node_put(np);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-10  5:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-10  5:48 [PATCH] drivers: hwmon: fix device_node_continue.cocci warnings Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox