Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
Cc: openbmc@lists.ozlabs.org, joel@jms.id.au, jdelvare@suse.com,
	linux@roeck-us.net, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org, corbet@lwn.net,
	linux-doc@vger.kernel.org, robh+dt@kernel.org,
	mark.rutland@arm.com, devicetree@vger.kernel.org,
	kbuild-all@01.org
Subject: [PATCH] drivers: hwmon: fix device_node_continue.cocci warnings
Date: Tue, 10 Jan 2017 06:48:02 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1701100646230.2185@hadrien> (raw)

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);

                 reply	other threads:[~2017-01-10  5:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1701100646230.2185@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jaghu@google.com \
    --cc=jdelvare@suse.com \
    --cc=joel@jms.id.au \
    --cc=kbuild-all@01.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox