Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163537AbbKTUr0 (ORCPT ); Fri, 20 Nov 2015 15:47:26 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:36485 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761032AbbKTUpS (ORCPT ); Fri, 20 Nov 2015 15:45:18 -0500 X-IronPort-AV: E=Sophos;i="5.20,324,1444687200"; d="scan'208";a="188467064" From: Julia Lawall To: Benjamin Herrenschmidt Cc: kernel-janitors@vger.kernel.org, Paul Mackerras , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Russell King - ARM Linux , Thomas Petazzoni , Andrew Lunn , Bjorn Helgaas , Jason Cooper Subject: [PATCH 5/6] powerpc/btext: add missing of_node_put Date: Fri, 20 Nov 2015 21:33:23 +0100 Message-Id: <1448051604-25256-6-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448051604-25256-1-git-send-email-Julia.Lawall@lip6.fr> References: <1448051604-25256-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 Content-Length: 1214 Lines: 55 for_each_node_by_type 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): // @@ local idexpression n; expression e; @@ for_each_node_by_type(n,...) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n // Signed-off-by: Julia Lawall --- arch/powerpc/kernel/btext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 41c011c..8d05ef2 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c @@ -257,8 +257,10 @@ int __init btext_find_display(int allow_nonstdout) rc = btext_initialize(np); printk("result: %d\n", rc); } - if (rc == 0) + if (rc == 0) { + of_node_put(np); break; + } } return rc; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/