From patchwork Tue Jun 12 17:23:16 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: 10460837 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 D96C660348 for ; Tue, 12 Jun 2018 17:24:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C69B8286DE for ; Tue, 12 Jun 2018 17:24:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB38828B14; Tue, 12 Jun 2018 17:24:57 +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 632EB286DE for ; Tue, 12 Jun 2018 17:24:57 +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: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:In-Reply-To: References:List-Owner; bh=NxJp8cfdCe6kxVePedlHapxLdGCVLdN+JaLyJmelBLI=; b=kuj yTK43vsCt/48ZMh4bd9FPenY+3Zid+0/EQkdX1s6N01/c0AXF91J3PK4nwvMnAUEPhyybOn4Mf4bL 4k+DE3+wGO510a0/PzVgKzWtnJKFeNjoSMvKBcXOhqTDhEToios27/GZjepTf4KDP+T7Vasjokbrf 10zxrCgRSUaGb/i3U3SLi+7T3i/Ioqta4DI0mELoZSoJuUJ5Ukw3+79yT3cLL0zprqvL0OTLU5kX/ i26nhlcjDUXXEbr8RUpWuA6iCJLvHJhWeum4IPIqEB5fk8Ca5DG7TP/BsMQVVU+GgKn5xRN4UKufH NAUeV2nJOa0IoXTvNA/8K3Ptp/iWtEw==; 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 1fSn2E-0003A3-R7; Tue, 12 Jun 2018 17:24:46 +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 1fSn1Z-0002kt-VZ for linux-arm-kernel@lists.infradead.org; Tue, 12 Jun 2018 17:24:43 +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 w5CHNUqM021912; Tue, 12 Jun 2018 19:23:31 +0200 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Subject: [PATCH] media: stm32-dcmi: simplify of_node_put usage Date: Tue, 12 Jun 2018 19:23:16 +0200 Message-Id: <1528824196-19149-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180612_102406_334373_712EDEF5 X-CRM114-Status: GOOD ( 11.82 ) 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 This does not fix any bug - this is just a code simplification. As np is not used after passing it to v4l2_fwnode_endpoint_parse() its refcount can be decremented immediately and at one location. Signed-off-by: Nicholas Mc Guire Acked-by: Hugues Fruchet --- Issue found during code reading. 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 few sparse warnings - but unrelated to the lines changed) Patch is against 4.17.0 (localversion-next is next-20180608) drivers/media/platform/stm32/stm32-dcmi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 2e1933d..0b61042 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -1696,23 +1696,20 @@ static int dcmi_probe(struct platform_device *pdev) } ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &ep); + of_node_put(np); if (ret) { dev_err(&pdev->dev, "Could not parse the endpoint\n"); - of_node_put(np); return -ENODEV; } if (ep.bus_type == V4L2_MBUS_CSI2) { dev_err(&pdev->dev, "CSI bus not supported\n"); - of_node_put(np); return -ENODEV; } dcmi->bus.flags = ep.bus.parallel.flags; dcmi->bus.bus_width = ep.bus.parallel.bus_width; dcmi->bus.data_shift = ep.bus.parallel.data_shift; - of_node_put(np); - irq = platform_get_irq(pdev, 0); if (irq <= 0) { dev_err(&pdev->dev, "Could not get irq\n");