From patchwork Sun Sep 4 06:45:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9313093 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 6C5A660760 for ; Mon, 5 Sep 2016 06:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59BF12888D for ; Mon, 5 Sep 2016 06:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E518289B1; Mon, 5 Sep 2016 06:04:24 +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=-4.2 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BE19B2888D for ; Mon, 5 Sep 2016 06:04:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69E176E333; Mon, 5 Sep 2016 06:04:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.smtpout.orange.fr (smtp09.smtpout.orange.fr [80.12.242.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 596AC6E05A for ; Sun, 4 Sep 2016 06:45:39 +0000 (UTC) Received: from localhost.localdomain ([92.140.166.52]) by mwinf5d32 with ME id fJlY1t007189VV003JlZS4; Sun, 04 Sep 2016 08:45:37 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 04 Sep 2016 08:45:37 +0200 X-ME-IP: 92.140.166.52 From: Christophe JAILLET To: p.zabel@pengutronix.de, airlied@linux.ie Subject: [PATCH] drm/imx: Fix of_node ref counting Date: Sun, 4 Sep 2016 08:45:23 +0200 Message-Id: <1472971523-4143-1-git-send-email-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.7.4 X-Antivirus: avast! (VPS 160903-1, 03/09/2016), Outbound message X-Antivirus-Status: Clean X-Mailman-Approved-At: Mon, 05 Sep 2016 06:04:02 +0000 Cc: Christophe JAILLET , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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-Virus-Scanned: ClamAV using ClamSMTP This code is spurious. It takes a ref on a node, then call 'of_node_put' on it and then store this node somewhere. It is likely that taking the ref on the parent node and releasing the child node was expected instead. So, use 'of_get_next_parent' instead. It does all this in just one function call. Signed-off-by: Christophe JAILLET --- Un-tested --- drivers/gpu/drm/imx/imx-drm-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 438bac8fbc2b..60fb388c80f8 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -449,10 +449,8 @@ static int compare_of(struct device *dev, void *data) } /* Special case for LDB, one device for two channels */ - if (of_node_cmp(np->name, "lvds-channel") == 0) { - np = of_get_parent(np); - of_node_put(np); - } + if (of_node_cmp(np->name, "lvds-channel") == 0) + np = of_get_next_parent(np); return dev->of_node == np; }