Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1109857imm; Wed, 1 Aug 2018 10:20:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4lOglbz0B75OYeZbMQSUHFxoUURGo1kBf9DFYDLPK1onyEdcifsSBQyJKjO2k3WEed45b X-Received: by 2002:a63:66c7:: with SMTP id a190-v6mr25162038pgc.411.1533144017876; Wed, 01 Aug 2018 10:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144017; cv=none; d=google.com; s=arc-20160816; b=PmH6xYfD+3DAZ/eRwV0FKjCZZnZ4GMj+vjfQrzoocAPnl1RTiEP7kAQCje2kxGWfpD VFKChVohGQBgzKhtQKNc3JimNvKbYWlKwiMQn/gKYttJaH9Wbk/35dyvH0WF87tHXrtn sJQsLAJHeiKJRxnkpojpkKzQ5PxZWVtNBSs0Rh5yqVywN6UqQza30ak7sKvD4+/TnW82 byDFfaU9+Oh5QXZ1+jpEWfHVCqjIuDU4b4bGy7n9IxcFkRR1QFa8FCw72SVWLZXLS5UT SiQJOAE8W0Ax8E0j4/HF/W8v2Fz7uhc9wrT4kT/tgddIaG1VrJwknR7togkT1QtJhPWC riSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=oy/GI1cWd5MA7EUK2BRyTPMqk25pNjwOup8jDfU6X9g=; b=bTkif+n2i4JQEQAj/wHDB3MGvuuc6SbGkBgCVitK1iUIVsxohOlJgx3DmBgkWpR2rn 0Ikolvqu+iR3zrvd0bxKtJwZ/lA6p3O/PNJKM1i7pVNeyeQv7q8qcBJfAYE5Nz0OThXv wBTBLUpSYjTdS/CizjDxAq9FBc4RB6bqdUpG5YdP2konHAfI+VkyD9cOFq/zIuDnDTOF p/0xaJ6FXJR3rcPlc3nKXDwN5HrOssjTzWu7rsgb2QoQbSPsA/KZit5CxtbTByQCu5wv x8JMs3qIb9TsAS6K+rV8sX64akGmfZVYZpQ4k+dqK+AqR0539YJzCfB0auRjMpDFb87j 3c6g== 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 e14-v6si16527488pgj.413.2018.08.01.10.20.03; Wed, 01 Aug 2018 10:20:17 -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 S2404975AbeHATFK (ORCPT + 99 others); Wed, 1 Aug 2018 15:05:10 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47338 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404582AbeHATFK (ORCPT ); Wed, 1 Aug 2018 15:05:10 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 17173CDF; Wed, 1 Aug 2018 17:18:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Ludovic Desroches , Linus Walleij , Sasha Levin Subject: [PATCH 4.14 107/246] pinctrl: at91-pio4: add missing of_node_put Date: Wed, 1 Aug 2018 18:50:17 +0200 Message-Id: <20180801165016.829794503@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Julia Lawall [ Upstream commit 21816364715f508c10da1e087e352bc1e326614f ] 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 Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-at91-pio4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- 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(str 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; + } } }