From patchwork Sat Oct 24 14:42:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 7480251 Return-Path: X-Original-To: patchwork-dri-devel@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 37671BEEA4 for ; Sat, 24 Oct 2015 14:53:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A6C720941 for ; Sat, 24 Oct 2015 14:53:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2A843208F4 for ; Sat, 24 Oct 2015 14:53:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE4D26E085; Sat, 24 Oct 2015 07:53:55 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by gabe.freedesktop.org (Postfix) with ESMTPS id E72586E085 for ; Sat, 24 Oct 2015 07:53:52 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.20,192,1444687200"; d="scan'208";a="151640353" 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: Thierry Reding Subject: [PATCH 5/9] drm/tegra: dc: add missing of_node_put Date: Sat, 24 Oct 2015 16:42:31 +0200 Message-Id: <1445697755-26341-6-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> Cc: Thomas Petazzoni , Alexandre Courbot , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Jason Cooper , Stephen Warren , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Bjorn Helgaas , Andrew Lunn , linux-tegra@vger.kernel.org, Russell King - ARM Linux X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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_matching_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): // @@ local idexpression n; expression e; @@ for_each_matching_node(n,...) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n // Signed-off-by: Julia Lawall --- drivers/gpu/drm/tegra/dc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index b4af4ab..f0e6f37 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1945,8 +1945,10 @@ static int tegra_dc_parse_dt(struct tegra_dc *dc) * cases where only a single display controller is used. */ for_each_matching_node(np, tegra_dc_of_match) { - if (np == dc->dev->of_node) + if (np == dc->dev->of_node) { + of_node_put(np); break; + } value++; }