Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1243182imm; Wed, 23 May 2018 12:40:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrMZYZ3RbUCqDHSRc72H1W1N3B6kZmQlgkkhLSsMcsVRoWx8u2Z6Ew/KqKkdKATrvA3lFhH X-Received: by 2002:a63:7341:: with SMTP id d1-v6mr3284546pgn.404.1527104449319; Wed, 23 May 2018 12:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527104449; cv=none; d=google.com; s=arc-20160816; b=KJOmzPP/rxMnc+UG6IthRuWhSE8fW1qHiRzbZlKFBIPVAnJpOa7cbvB1Qc9ehr2aGv KYBlpx0GuHZKA3dGLKRUxisqJjEfKRgZZR6+fjBMpVcjZwGMwSMufGkViOkdahHtTiue uyLGym0EiiCXg6kQm7ZWoy//suKyyLpDnHfY4gWa444XaKA+jAmom7VMfbKXxSpcxJ2/ ObYjyz2L0n2QfQ92+5FvgSOrhY3O1ED6IvCB9xu5tMquzk1hqudYmitPw4eSasnh2MfW Mo1MIuk/F2jbBobjJG/O5KtytdN0w4G8U/CXy3jCvJox0sQedRS3eJhJMpigOLULhh7O XZXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fPFk8MZK1xLHcbv24AYAObhyjTjqwplhnKNgUdbNPjM=; b=m9Tcdo211yGMbP6mx/9bEb5g6PXh7BRF/MAr7JQi+eO8oVLUUvz2R7mlpeXgjHy3RX vBcwPVeB7BL5sGC3bSndawfq/TUZVY6TrdP4hHh+APbHMEb31xiKlgPZ7ohBLGN28EbO 7rIIv1FTw4uei6HQBw/J7Wq8B9nCxfDX7LHLIywUJugYz3W7u4wj4xIMcYla0oZXadj0 HeFFoA34psszWzuFOOR1Tl/rJugb3T9uBRa0ZExlFncUxYJBS0wowqwc9v+UzAMeZlsO 5zF/XkLVCj8+5NxIPKeCeivzknniaL0mhtAqQbG3a1hG7oONbXc7kRMPy2IIx7RfyJFs vdxw== 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 b96-v6si19726595pli.172.2018.05.23.12.40.34; Wed, 23 May 2018 12:40:49 -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 S934812AbeEWTjy (ORCPT + 99 others); Wed, 23 May 2018 15:39:54 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:30112 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934243AbeEWTjB (ORCPT ); Wed, 23 May 2018 15:39:01 -0400 X-IronPort-AV: E=Sophos;i="5.49,434,1520895600"; d="scan'208";a="328129390" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 23 May 2018 21:38:58 +0200 From: Julia Lawall To: Ludovic Desroches Cc: 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 Subject: [PATCH 1/5] pinctrl: at91-pio4: add missing of_node_put Date: Wed, 23 May 2018 21:07:12 +0200 Message-Id: <1527102436-13447-2-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> References: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; + } } }