Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1823393imm; Thu, 24 May 2018 01:12:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxanysoLRy6oBMi/5peSumLwUiPRB/ZuuqCDSgQ0lUNFxxosp6hniJaltWRbP+X6Dxr+9i X-Received: by 2002:a65:5144:: with SMTP id g4-v6mr5064721pgq.445.1527149544289; Thu, 24 May 2018 01:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527149544; cv=none; d=google.com; s=arc-20160816; b=f25ZmOdlc/HlPjVHnYlTTemBO12MBVmyIQFlFG9GgaDUB8TP/OVRreTlCVUuFtHhWS IoF5Ie05gtU24W2K7QnztjuNy+ZYeoDoTIHCS7VlkLyNt772TW4C/bmvuNF/AOoMg5tP YX1RrcpEiApBzPTGo4FFrUjUacRnAAulMrAo2N2PxNDFv+6e42B0r49oyUxZXqTdL51E gvxEXHJP7MzycqxuZK61UQDg+vSQuTGUs+uswmGvZhi7Ekxchx8dI3n79q1PE50WE6Bn ABfNENMQkkC9ppDZTSzMN2LEIgbUIzweq+Z1BZi77PeDlus9Oho76jOhBcPDC1iiqsEc lq8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=YnXRzq287TN085buMBuAb/GBSaileKl/rdJMpwTKeqs=; b=LFHAL4B2F9b1GSoUf2KytXAG1fqIErHkrj8BUOHypKREoxcXzJyilAzXKN2zH7Enyr QGmfQuABCrAbygFwYUo672Ev1M5I71v4O9U0ij71OCmXcchWpYAT9snZosloU1lPE1cD PGEovll1XlwQ7r5due432nqlm5PFG+quS2Cg4Jrm7mRPyI5Kp8aBp0MT+A0HNPCHtQXO bsmCuABXgkN47F6cFKl+GtjMcOX5FYAmKF7pqiEklI1hYnBvq2oU5lVYIGZ9HNRiwkRA MVkMSiMwA6A0Of+DHMef6R06J/MqGO62zaYmGeJdrMxP2GU0StO4SeBf5+sP51BZ4ePi Q6OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e125-v6si20668648pfg.112.2018.05.24.01.12.09; Thu, 24 May 2018 01:12:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935854AbeEXIAz (ORCPT + 99 others); Thu, 24 May 2018 04:00:55 -0400 Received: from esa6.microchip.iphmx.com ([216.71.154.253]:8482 "EHLO esa6.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935785AbeEXIAX (ORCPT ); Thu, 24 May 2018 04:00:23 -0400 X-IronPort-AV: E=Sophos;i="5.49,436,1520924400"; d="scan'208";a="11861485" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 May 2018 01:00:19 -0700 Received: from localhost (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.352.0; Thu, 24 May 2018 01:00:18 -0700 Date: Thu, 24 May 2018 09:59:29 +0200 From: Ludovic Desroches To: Julia Lawall CC: Ludovic Desroches , , Linus Walleij , Nicolas Ferre , Alexandre Belloni , , , Subject: Re: [PATCH 1/5] pinctrl: at91-pio4: add missing of_node_put Message-ID: <20180524075929.GA3750@rfolt0960.corp.atmel.com> Mail-Followup-To: Julia Lawall , kernel-janitors@vger.kernel.org, Linus Walleij , Nicolas Ferre , Alexandre Belloni , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org References: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> <1527102436-13447-2-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1527102436-13447-2-git-send-email-Julia.Lawall@lip6.fr> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 09:07:12PM +0200, Julia Lawall wrote: > The device node iterators perform an of_node_get on each iteration, so a > jump out of the loop requires an of_node_put. > > The semantic patch that fixes this problem is as follows > (http://coccinelle.lip6.fr): > > // > @@ > expression root,e; > local idexpression child; > iterator name for_each_child_of_node; > @@ > > for_each_child_of_node(root, child) { > ... when != of_node_put(child) > when != e = child > + of_node_put(child); > ? break; > ... > } > ... when != child > // > > Signed-off-by: Julia Lawall Acked-by: Ludovic Desroches Thanks > > --- > drivers/pinctrl/pinctrl-at91-pio4.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c > index 4b57a13..bafb3d4 100644 > --- a/drivers/pinctrl/pinctrl-at91-pio4.c > +++ b/drivers/pinctrl/pinctrl-at91-pio4.c > @@ -576,8 +576,10 @@ static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, > for_each_child_of_node(np_config, np) { > ret = atmel_pctl_dt_subnode_to_map(pctldev, np, map, > &reserved_maps, num_maps); > - if (ret < 0) > + if (ret < 0) { > + of_node_put(np); > break; > + } > } > } > >