From patchwork Mon Jun 25 12:02:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 10486007 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 F3AF360230 for ; Mon, 25 Jun 2018 13:06:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1CC428514 for ; Mon, 25 Jun 2018 13:06:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5A6E28585; Mon, 25 Jun 2018 13:06:51 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 540A328514 for ; Mon, 25 Jun 2018 13:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=pOOMQvvD4E+eF9RrnIWA3ZWbl34SN4UTZe1743oLsjw=; b=lf4aBQWK0Lom4QfJ0XQnPGV85F WrNSP76Ow3955ECHwjkqDkMqbPun433rF0OCK6lka+trPX9YRUOhq3gTp7wLqGvrYYqC019R3jTZt VCAHZX8ceuZKr1Vptygcee+QSvD+N5yBmSzQ9oHF3SQgyXv9f9sUXaUO6dNrsIyob8N0ql9O1KSpX 0TkeH1zkwyPPyxfev4DTQpD6BZc6J5K5qLgChepI9HAc0QwVqdh7Pl+J3QtYoOOE4iHpSlvRzRvdt eXkDcLE0nOmO6GOSYRU/hE7SNAiWi8DRpJHvSerrm85gWfieUlRAOhr3gKeCoJ+2TvyHLMfrNbEKI W8mR936A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXRCV-0003eg-3G; Mon, 25 Jun 2018 13:06:35 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXR9K-0000Ta-3u for linux-arm-kernel@bombadil.infradead.org; Mon, 25 Jun 2018 13:03:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/fDeLAQZQFjHwt2U+cjOsQu7enRW9rSa6r/BC4fzQPE=; b=v1tVB02YGaVauW767EYDC2CRB tQWRjLRFXWcbDGs9lQZtksFHMPRVDiIKY+CIcmKorkRK0LSqlfRWGKvPiYPsUXDv1LtVYmtlM+hy6 N5tBoMxCQspxdeHHVE2egJpzN1Np5v0tLqsvmhsq2Dw2OhmH4iGLgImDdxRnG7rQEgIiWV+627deM yTLTxugkHKigvzMdzr/XKv6d8Ihcch5JWmQ4obtLZ6BXhpgdIzD212IZWnTZmrgiztkHDkNv7jKGZ 3W2Q2Lk9WImtBczab4G00/t00HK+w+/lOrGaZoMPO2nQRXs+YOf52gad/NOm1cBO+pMmzbzmOPFl7 PT+sgwzXg==; Received: from mailoutvs31.siol.net ([185.57.226.222] helo=mail.siol.net) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fXQFF-0007jj-FC for linux-arm-kernel@lists.infradead.org; Mon, 25 Jun 2018 12:05:22 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id A9FD75208B0; Mon, 25 Jun 2018 14:04:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta10.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta10.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ckGU0Eh94Vl6; Mon, 25 Jun 2018 14:04:58 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 46276520604; Mon, 25 Jun 2018 14:04:58 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id B4EAF5208B0; Mon, 25 Jun 2018 14:04:54 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Subject: [PATCH v3 06/24] drm/sun4i: Fix releasing node when enumerating enpoints Date: Mon, 25 Jun 2018 14:02:46 +0200 Message-Id: <20180625120304.7543-7-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180625120304.7543-1-jernej.skrabec@siol.net> References: <20180625120304.7543-1-jernej.skrabec@siol.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180625_080521_682849_9B15A213 X-CRM114-Status: GOOD ( 13.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, airlied@linux.ie, gustavo@padovan.org, maarten.lankhorst@linux.intel.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, seanpaul@chromium.org, linux-clk@vger.kernel.org, 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-Virus-Scanned: ClamAV using ClamSMTP sun4i_drv_add_endpoints() has a memory leak since it uses of_node_put() when remote is equal to NULL and does nothing when remote has a valid pointer. Invert the logic to fix memory leak. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun4i_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 50d19605c38f..e15fa2389e3f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -283,7 +283,6 @@ static int sun4i_drv_add_endpoints(struct device *dev, remote = of_graph_get_remote_port_parent(ep); if (!remote) { DRM_DEBUG_DRIVER("Error retrieving the output node\n"); - of_node_put(remote); continue; } @@ -297,11 +296,13 @@ static int sun4i_drv_add_endpoints(struct device *dev, if (of_graph_parse_endpoint(ep, &endpoint)) { DRM_DEBUG_DRIVER("Couldn't parse endpoint\n"); + of_node_put(remote); continue; } if (!endpoint.id) { DRM_DEBUG_DRIVER("Endpoint is our panel... skipping\n"); + of_node_put(remote); continue; } }