From patchwork Sat Oct 24 14:42:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 7480331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9AC99BEEA4 for ; Sat, 24 Oct 2015 14:56:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BEE382068E for ; Sat, 24 Oct 2015 14:56:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0B532069A for ; Sat, 24 Oct 2015 14:56:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zq0DL-0006lW-Kb; Sat, 24 Oct 2015 14:54:35 +0000 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zq0D2-0006Jt-HS for linux-arm-kernel@lists.infradead.org; Sat, 24 Oct 2015 14:54:17 +0000 X-IronPort-AV: E=Sophos;i="5.20,192,1444687200"; d="scan'208";a="151640358" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 24 Oct 2015 16:53:49 +0200 From: Julia Lawall To: Santosh Shilimkar Subject: [PATCH 8/9] soc: ti: knav_qmss_queue: add missing of_node_put Date: Sat, 24 Oct 2015 16:42:34 +0200 Message-Id: <1445697755-26341-9-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445697755-26341-1-git-send-email-Julia.Lawall@lip6.fr> References: <1445697755-26341-1-git-send-email-Julia.Lawall@lip6.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151024_075416_943867_B38D9DFF X-CRM114-Status: GOOD ( 11.70 ) X-Spam-Score: -6.1 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni , Andrew Lunn , Russell King - ARM Linux , Jason Cooper , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 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. A simplified version of 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 --- drivers/soc/ti/knav_qmss_queue.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c index 89789e2..6f3d12b 100644 --- a/drivers/soc/ti/knav_qmss_queue.c +++ b/drivers/soc/ti/knav_qmss_queue.c @@ -1074,6 +1074,7 @@ static int knav_queue_setup_regions(struct knav_device *kdev, region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL); if (!region) { dev_err(dev, "out of memory allocating region\n"); + of_node_put(child); return -ENOMEM; } @@ -1373,6 +1374,7 @@ static int knav_queue_init_qmgrs(struct knav_device *kdev, qmgr = devm_kzalloc(dev, sizeof(*qmgr), GFP_KERNEL); if (!qmgr) { dev_err(dev, "out of memory allocating qmgr\n"); + of_node_put(child); return -ENOMEM; } @@ -1450,6 +1452,7 @@ static int knav_queue_init_pdsps(struct knav_device *kdev, pdsp = devm_kzalloc(dev, sizeof(*pdsp), GFP_KERNEL); if (!pdsp) { dev_err(dev, "out of memory allocating pdsp\n"); + of_node_put(child); return -ENOMEM; } pdsp->name = knav_queue_find_name(child);