From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:58114 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750761AbdAJFsP (ORCPT ); Tue, 10 Jan 2017 00:48:15 -0500 Date: Tue, 10 Jan 2017 06:48:02 +0100 (CET) From: Julia Lawall To: Jaghathiswari Rankappagounder Natarajan 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 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-hwmon-owner@vger.kernel.org List-Id: linux-hwmon@vger.kernel.org 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 Signed-off-by: Julia Lawall Signed-off-by: Fengguang Wu --- 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);