From patchwork Thu Oct 15 00:33:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 7400911 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DD4AE9F4DD for ; Thu, 15 Oct 2015 02:41:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1722A2076A for ; Thu, 15 Oct 2015 02:41:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 289EF20785 for ; Thu, 15 Oct 2015 02:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754171AbbJOCls (ORCPT ); Wed, 14 Oct 2015 22:41:48 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:34146 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751875AbbJOCls (ORCPT ); Wed, 14 Oct 2015 22:41:48 -0400 Received: from reginn.isobedori.kobe.vergenet.net (p2250-ipbfp1101kobeminato.hyogo.ocn.ne.jp [122.22.210.250]) by kirsty.vergenet.net (Postfix) with ESMTPA id 1B23225BDA6; Thu, 15 Oct 2015 11:33:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=verge.net.au; s=mail; t=1444869238; bh=/Vu39lxnEES0cGOl1FTU1W7+AagqzIZvkoQUiK+vE64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7IN0odg3QKotS74l0iWcHlFTLhKQX7KDIj3A+Q72b2BYhePnC7kwfOcQGEKDaV6n NzKLOVqQxREe+5pi1TL5Q0lHh3pLEXe2DX4dV3BXo607rKuUOlzk1ZoA1nOEaQUf23 VXbZ7+8I/+P7hef7SotryDOD5eU3veHG8yQALq8o= Received: by reginn.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id 345039405C6; Thu, 15 Oct 2015 09:33:56 +0900 (JST) From: Simon Horman To: linux-sh@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Magnus Damm , Julia Lawall , Simon Horman Subject: [PATCH 6/6] ARM: shmobile: R-Mobile: add missing of_node_put Date: Thu, 15 Oct 2015 09:33:54 +0900 Message-Id: <1fd377b3fc1e071702e27b2f828e3abd8b31c74d.1444868660.git.horms+renesas@verge.net.au> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Julia Lawall for_each_child_of_node performs an of_node_get on each iteration, so a break 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; @@ for_each_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // Signed-off-by: Julia Lawall Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/pm-rmobile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index a5b96b990aea..424155b0cfe9 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c @@ -342,8 +342,10 @@ static int __init rmobile_add_pm_domains(void __iomem *base, } pd = kzalloc(sizeof(*pd), GFP_KERNEL); - if (!pd) + if (!pd) { + of_node_put(np); return -ENOMEM; + } pd->genpd.name = np->name; pd->base = base;