From patchwork Wed May 23 19:07:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 10422323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D3B5260224 for ; Wed, 23 May 2018 20:07:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1827291F2 for ; Wed, 23 May 2018 20:07:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5AD8291F4; Wed, 23 May 2018 20:07:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 35438291F2 for ; Wed, 23 May 2018 20:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PUzVWH3MDF937+Mqx3ZCa+I/Nb2l5AGHk+DHO8Jd/ro=; b=gKWVtkWqyIXAUeaJDMPMUnkEw0 V9SxUs6VzCg7Ktk8Go7CbzCt1uoIH6eaIpw2QGXmXEWJ1xxwx+y7lNZrnsRZYNgvHgcGwceaUVJ1r biDE/BWTVf1OxDFLI4fxmu4nfJBDhWyEm/DlSW+zsZK3zmaw6liBsuo82xDtiY6d6yKreScprxfeM UHhiAXQhXCDBTJDZk1C7VHqUwTJJFPjjB/DIkUPYH95BnT8N301NiZBjjCmD1PF+ewR36W8Rv6vxO exn60YK1vYwLYFKK1CZTFyqfMO/t5o+S/Magst1k41AM4KBlRWcclhE0jjqKEKVTi2BecTnynN74N fLeYTHMA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLa2z-0000Wa-Ad; Wed, 23 May 2018 20:07:45 +0000 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLa2v-0000V2-KP for linux-arm-kernel@lists.infradead.org; Wed, 23 May 2018 20:07:43 +0000 X-IronPort-AV: E=Sophos;i="5.49,434,1520895600"; d="scan'208";a="328129392" 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: Santosh Shilimkar Subject: [PATCH 3/5] soc: ti: knav_dma: add missing of_node_put Date: Wed, 23 May 2018 21:07:14 +0200 Message-Id: <1527102436-13447-4-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180523_130741_949555_010CE5A5 X-CRM114-Status: GOOD ( 10.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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/soc/ti/knav_dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/ti/knav_dma.c b/drivers/soc/ti/knav_dma.c index 224d7dd..bda3173 100644 --- a/drivers/soc/ti/knav_dma.c +++ b/drivers/soc/ti/knav_dma.c @@ -768,6 +768,7 @@ static int knav_dma_probe(struct platform_device *pdev) ret = dma_init(node, child); if (ret) { dev_err(&pdev->dev, "init failed with %d\n", ret); + of_node_put(child); break; } }