From patchwork Tue Jun 12 17:22:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10460823 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 F0D55601A0 for ; Tue, 12 Jun 2018 17:23:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D022B277D9 for ; Tue, 12 Jun 2018 17:23:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C47EE28334; Tue, 12 Jun 2018 17:23:35 +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 2D85D277D9 for ; Tue, 12 Jun 2018 17:23:35 +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=UKfjpkb3cpqTVfC7B64+9yA0KSp3004DEBsSl0tBKsc=; b=Osz1VA5oJbo0XKjZk0ANrCLGhR PBAmqJyAB0KrU0H0CKxCGARdUlH15ZpR1RGIr6lIZ/VOYgpyPWBM7wfx+V97VxF5yHOgddJ2oKulz 3dzZgldwibHcRQUrX+mSShE/tO/jGdHjaThFmwUec/MvyNlOztom01wVV2S8kZxwn5KuQ72wFxtHI jqSizTwNOlwyGWXw+bZ3NL0z1RIigir2QjwtWOD5gJ1SnrNGRy+9Ck1ZqmrwGMQg1PUdjY3T67WHE 3a/4pNOIEBgOG2E+N3cDIPxvon33PNUngZwbb6hjSsVXq41iiu4NsXNdBq0q5pOJlnqa8QRwYSBxv YT4UtElw==; 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 1fSn11-0002XN-TL; Tue, 12 Jun 2018 17:23:31 +0000 Received: from www.osadl.org ([2001:a60:9266:ffff:62:245:132:105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSn0x-0001nj-U5 for linux-arm-kernel@lists.infradead.org; Tue, 12 Jun 2018 17:23:30 +0000 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w5CHMdrw021809; Tue, 12 Jun 2018 19:22:46 +0200 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Subject: [PATCH 2/2] media: stm32-dcmi: add mandatory of_node_put() in success path Date: Tue, 12 Jun 2018 19:22:18 +0200 Message-Id: <1528824138-19089-2-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1528824138-19089-1-git-send-email-hofrat@osadl.org> References: <1528824138-19089-1-git-send-email-hofrat@osadl.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180612_102328_283868_1C9464B1 X-CRM114-Status: GOOD ( 12.32 ) 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: Maxime Coquelin , Niklas Soderlund , Alexandre Torgue , Benjamin Gaignard , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, Hans Verkuil , Philipp Zabel , Nicholas Mc Guire , Hugues Fruchet , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.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 The endpoint allocated by of_graph_get_next_endpoint() needs an of_node_put() in both error and success path. As ep is not used the refcount decrement can be right after the last use of ep. Signed-off-by: Nicholas Mc Guire Fixes: commit 37404f91ef8b ("[media] stm32-dcmi: STM32 DCMI camera interface driver") Acked-by: Hugues Fruchet --- Problem located with an experimental coccinelle script Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y CONFIG_VIDEO_STM32_DCMI=y (There are a number of sparse warnings - not related to the changes though) Patch is on top of "[PATCH 1/2] media: stm32-dcmi: drop unneceeary while(1) loop" against 4.17.0 (localversion-next is next-20180608) drivers/media/platform/stm32/stm32-dcmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 70b81d2..542d148 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -1610,10 +1610,9 @@ static int dcmi_graph_parse(struct stm32_dcmi *dcmi, struct device_node *node) return -EINVAL; remote = of_graph_get_remote_port_parent(ep); - if (!remote) { - of_node_put(ep); + of_node_put(ep); + if (!remote) return -EINVAL; - } /* Remote node to connect */ dcmi->entity.node = remote;