From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751427AbcL2VKg (ORCPT ); Thu, 29 Dec 2016 16:10:36 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:32758 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbcL2VKf (ORCPT ); Thu, 29 Dec 2016 16:10:35 -0500 X-IronPort-AV: E=Sophos;i="5.33,428,1477954800"; d="scan'208";a="206423086" Date: Thu, 29 Dec 2016 22:10:32 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Joachim Eastwood cc: Riku Voipio , Richard Purdie , Jacek Anaszewski , Pavel Machek , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, kbuild-all@01.org Subject: [PATCH] leds: pca9532: fix device_node_continue.cocci warnings Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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 Signed-off-by: Julia Lawall Signed-off-by: Fengguang Wu --- I haven't looked at the context in detail, but given the rule, I assume that there is an iterator, such as for_each_child_of_node, and these iterators do a put on each iteration, so none is needed in the loop body. tree: https://github.com/manabian/linux-lpc lpc18xx_43xx_devel head: 9ee5f58bbb16c08da223c4b4933457e0eb72268d commit: c58957273142be779f62c17fae389ce9c134139f [44/55] leds: pca9532: use leds-pca9532.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c @@ -473,7 +473,6 @@ pca9532_of_populate_pdata(struct device res = of_property_read_u32(child, "reg", ®); if ((res != 0) || (reg >= maxleds)) { - of_node_put(child); continue; } @@ -484,8 +483,6 @@ pca9532_of_populate_pdata(struct device of_property_read_u32(child, "type", &pdata->leds[reg].type); of_property_read_string(child, "linux,default-trigger", &pdata->leds[reg].default_trigger); - - of_node_put(child); } return pdata;