From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934528AbeEWTjH (ORCPT ); Wed, 23 May 2018 15:39:07 -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 S934286AbeEWTjD (ORCPT ); Wed, 23 May 2018 15:39:03 -0400 X-IronPort-AV: E=Sophos;i="5.49,434,1520895600"; d="scan'208";a="328129392" From: Julia Lawall To: Santosh Shilimkar Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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> Sender: linux-kernel-owner@vger.kernel.org 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/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; } } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Date: Wed, 23 May 2018 19:07:14 +0000 Subject: [PATCH 3/5] soc: ti: knav_dma: add missing of_node_put Message-Id: <1527102436-13447-4-git-send-email-Julia.Lawall@lip6.fr> List-Id: References: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-arm-kernel@lists.infradead.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/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; } } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia.Lawall@lip6.fr (Julia Lawall) Date: Wed, 23 May 2018 21:07:14 +0200 Subject: [PATCH 3/5] soc: ti: knav_dma: add missing of_node_put In-Reply-To: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> References: <1527102436-13447-1-git-send-email-Julia.Lawall@lip6.fr> Message-ID: <1527102436-13447-4-git-send-email-Julia.Lawall@lip6.fr> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.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/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; } }