From patchwork Sun Jun 10 15:23:53 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: 10456687 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 E1EB460467 for ; Sun, 10 Jun 2018 15:25:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFD9A26E47 for ; Sun, 10 Jun 2018 15:25:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C128C26E55; Sun, 10 Jun 2018 15:25:40 +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 0CA6A26E47 for ; Sun, 10 Jun 2018 15:25:39 +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=Zm0 Rxsz3zg690aBA0u7I9IPWR3J7xBo5gQa2xFm7QgHaSvGRB2Bfjo1n8rUo7KtfCgbuE27Y7m6vowOf FCig2t0F+Ujjszys9KCFffMFtmQwcliIij/RM/+2CffODjXvcOvKdyi4LuF3C9ltL6gJClOjzLNNp DeIwQ8bANx5Csg1G7it/K494eGSV2/J2d6ngBwJAaNZNdqXwCxRVcZSnffhHfFbzHyZE+ixAQbbjf eUue+5JLgL6iDqJB0SmeKkjKCzbjGPYm8bmUUZzZHwMuLUx/tBWpLPEwvmfMbHS7pFu0Xl3ktoB1r EBbXtuAPvrHSfO2Y3zV0G5iU+9VE5aw==; 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 1fS2Dm-0004jU-6V; Sun, 10 Jun 2018 15:25:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fS2Dk-0004iq-0z for linux-arm-kernel@bombadil.infradead.org; Sun, 10 Jun 2018 15:25:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=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:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=++tmH5qyxIEUZ9GERjoLbuB8pslVButiWzM99dG2EWU=; b=j/u78U00/Vbwfsl0DgwrML4So vINok/uaZDsKIO0Pt4nBnGcRUbKtX/vr/8kLLxMHSh1fitDe0JQh5pyWaRn1bRRsXF+QxcFeSzCgK cXPZtLynlEyFlZrVXkBoqNBunQzWpHWPLQUc0d6sBpnTiO5S/Spq/jGhjwQEgdS6Nf8AeuWLkg0k1 zfQSGq8oq9/02wfv6rytIKszLvy5+CtAnPUMri9HIZUVR4KAj24/Gzlys4Ii6CvkdGhhREEGjIp5z oeFTsZZbmGxViLPntBMpJMKqkTYDBHYOooJwDQIJ5lyyqLeS8XR6ofBzqS6z+WxgACPemDlaHb+8F UNcdgQpYg==; Received: from www.osadl.org ([2001:a60:9266:ffff:62:245:132:105]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fS2Dg-0005qd-Tk for linux-arm-kernel@lists.infradead.org; Sun, 10 Jun 2018 15:25: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 w5AFO5IM017365; Sun, 10 Jun 2018 17:24:05 +0200 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Subject: [PATCH] media: stm32-dcmi: simplify of_node_put usage Date: Sun, 10 Jun 2018 17:23:53 +0200 Message-Id: <1528644233-10371-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-20180610_162529_018669_2FD7FC0E X-CRM114-Status: GOOD ( 12.73 ) 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 --- 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");