Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3142021imm; Sun, 10 Jun 2018 09:18:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKfk96c02Y071EePMGK9PAmIxQpJmbygkCUXr0xSN3hIdyrocuqnfSMe5Rk646FCet3zCg1 X-Received: by 2002:a17:902:8b85:: with SMTP id ay5-v6mr14911680plb.30.1528647535795; Sun, 10 Jun 2018 09:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528647535; cv=none; d=google.com; s=arc-20160816; b=TIuLSBYFtTXygNHylaeBjOt3jZFpc9Utjo2n3aFGF1IrZFxIGvmbUOdkPGq/yaFkCy 4ZUExb+T3Uhd2Ub0PwQw0sRbRDPh8LOK/L4quPhdgp30FE6KlTsQebgNdXbebm4IwdbN 6DQe3uB89S+CA0wX/bwUF/cofrgpfTQPmnT6UB8L3fR9WXtNnkcqaUNL3djEh3q18d9g gBpDEyxNi/arvY4w/UJSZHYBKPPJCbykUWMgz3wjIeM/N/sDx8XvBk6sMywGoTzn6yZF UtFg46Q+SqTkc7QLPeROjBinhd/NA13JbYt60jMAo4jOfVCAz2Cai+BdfZC9xqxzsMYG dE5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=++tmH5qyxIEUZ9GERjoLbuB8pslVButiWzM99dG2EWU=; b=RXQ0r9Anadl4rWwvxbdrRlInr+W63T6qTmVTcWI5fha5rymQBO/ZiEVtStq0RJXCfb /6m8CVzXCp5/gG+lZYnyRG/1PYyOFMvUzDjnntD+x3oAWHOq0FfQGdBdSIpPj1Xz3Mvb 0RLfVWaXW5cY+fFNhIho6TJzQHSdTGxl9qW8ekifOONyBjfg2GSvnJN3EMAImPH5QTF2 I6+0XYp2BlYtgKe3TwYWtdBeGDIJRPs9UBdecmFwVZScoq0+d8eJ/hsWrFVYSLZVV9ej +O606eGkCDSg7l9E7Cg6onGeEyvH9ImjjChqqCPmAqe26xZW3UapycB8D1ykJz9dkwhN 9JDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32-v6si60196402pld.435.2018.06.10.09.18.31; Sun, 10 Jun 2018 09:18:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753655AbeFJQR5 (ORCPT + 99 others); Sun, 10 Jun 2018 12:17:57 -0400 Received: from www.osadl.org ([62.245.132.105]:46520 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753516AbeFJQR4 (ORCPT ); Sun, 10 Jun 2018 12:17:56 -0400 X-Greylist: delayed 3139 seconds by postgrey-1.27 at vger.kernel.org; Sun, 10 Jun 2018 12:17:55 EDT 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 Cc: Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Hugues Fruchet , Philipp Zabel , Niklas Soderlund , Benjamin Gaignard , "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire 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-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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"); -- 2.1.4