From patchwork Thu Dec 29 13:31:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 37393 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2402941wrt; Thu, 29 Dec 2022 05:34:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXv68Io37Y0ay+5KHKu8KBslDlVr6rBPZfnI8QZ7cIi19paTnA6zr76EHuv9Mtx5Ixo8+E3N X-Received: by 2002:aa7:8c46:0:b0:575:ff07:cb1e with SMTP id e6-20020aa78c46000000b00575ff07cb1emr32726516pfd.31.1672320841553; Thu, 29 Dec 2022 05:34:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672320841; cv=none; d=google.com; s=arc-20160816; b=B0wl5yp5mylABuvc+wFM7OcUJ2Fb2NBETo1cjuSBPQWm0RQFwSvzysnqLmykQ6aJI4 fdjNzyGViZlLUpcd9MSyFD4g/amam3jMTV5LXyC7PTwwRoXbH99sM4/LuqrfemO8jcsu l8O2L4A0zGNXJ9vW+S9E2m0LFa5IulnjVKAQjFnVaQDEiLA8/rUf878pKsp7v7GF8/re iQqsOkLZGhSWsZ6XVrTeJdk9NVyeoX6EZPthv5bysoQ4np399pvhTp96eh5/FFnMBqAb RWx0m1snZQBFWvXpdv+PzfynrJHnP3rgCMKrnXPs5lmiHhCCuAt+h0n+LEPjbJOK+ljZ G1/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nsmhIDmSSfH619hRw6C44IlZdoLkr++cNYpPRM0qeT8=; b=OE+GAoHOEXg+P8kB+RR00nYh3BmqDb4S+AZmctKqdoDIiT26PCqcydOOem0XR05WZA Q/6g7/B9yD4E3WMExvA91uNyga1qfpPzwe5KCw/bV5D4mb/lQdl/zUVMJhd0mTwPlMqH RCyDaNBq8zavPjGT6PliZAWA3BlXxSRejDYd1XZxec1tjsm/gDIWK3rnWQJRq8kvpEzR cQB9ppFEkcrgtPPPi0KWHZkfRh3ZGAaIyLT4eSCCKfPHWmNjfMYlk+WWfHxKgZQ/ybC2 bY3/vUh/o8oF2VsXTSmHaqIOSf2vAxSYNdqWtlMDmCE0s90oYFkNtiMjv8LUoPcu8efH MkXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bINMhtij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a62b403000000b0057af1413b10si17599164pfn.40.2022.12.29.05.33.44; Thu, 29 Dec 2022 05:34:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=bINMhtij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233509AbiL2NdQ (ORCPT + 99 others); Thu, 29 Dec 2022 08:33:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233386AbiL2Nck (ORCPT ); Thu, 29 Dec 2022 08:32:40 -0500 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C58C810B7C; Thu, 29 Dec 2022 05:32:38 -0800 (PST) Received: from booty.fritz.box (unknown [77.244.183.192]) (Authenticated sender: luca.ceresoli@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 476C9FF805; Thu, 29 Dec 2022 13:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1672320757; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nsmhIDmSSfH619hRw6C44IlZdoLkr++cNYpPRM0qeT8=; b=bINMhtijHQXwSNYJl+84GZHHzEQtngyD0Ylkserq7dtkBOZvIdhn/O7XAbm/V7vHOPi6xZ Usu+/V2wW4TvKHHPFczFi66RoToaLtclBzZn6LBe6HFK09a3tml7UNABtJOTNtFT2a0Nmn ROAg9WQWPd0Qh4ooZjgNeIxeEgVrN99yyRGQSsQl/amX9ETq+ddGVBg2P04Msx7ilAY0cb DkPfgF3ez/DuhVwGXsO8bliwHH7q3t1O4G2G0A45tLcacMNNh8UbeKB7fNoxzEVYO0IS4t T8gPPH/v1s8XeZLZ1N+TJN9pHW3nisAm2c4+YOkxpsF/FQDWtjFqrlHIZr3kEg== From: Luca Ceresoli To: Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Dmitry Osipenko , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Thomas Petazzoni , Paul Kocialkowski , Richard Leitner Subject: [PATCH v3 08/21] staging: media: tegra-video: slightly simplify cleanup on errors Date: Thu, 29 Dec 2022 14:31:52 +0100 Message-Id: <20221229133205.981397-9-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221229133205.981397-1-luca.ceresoli@bootlin.com> References: <20221229133205.981397-1-luca.ceresoli@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753555498656435919?= X-GMAIL-MSGID: =?utf-8?q?1753555498656435919?= of_node_put(node) does nothing if node == NULL, so it can be moved to the cleanup section at the bottom. Signed-off-by: Luca Ceresoli --- No changes in v3 No changes in v2 --- drivers/staging/media/tegra-video/vi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index 0e5067a7986a..c2724e1ecafb 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -1263,7 +1263,7 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) struct device_node *node = vi->dev->of_node; struct device_node *ep = NULL; struct device_node *ports; - struct device_node *port; + struct device_node *port = NULL; unsigned int port_num; struct device_node *parent; struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 }; @@ -1286,7 +1286,6 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) dev_err(vi->dev, "invalid port num %d for %pOF\n", port_num, port); ret = -EINVAL; - of_node_put(port); goto cleanup; } @@ -1309,13 +1308,12 @@ static int tegra_vi_channels_alloc(struct tegra_vi *vi) lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes; ret = tegra_vi_channel_alloc(vi, port_num, port, lanes); - if (ret < 0) { - of_node_put(port); + if (ret < 0) goto cleanup; - } } cleanup: + of_node_put(port); of_node_put(ports); return ret; }