Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp5991029rwl; Thu, 29 Dec 2022 06:05:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXsexuhambNGzbFY5bY/v0LjgfkGw7lYLCkdNfzaP4IjPvt2MBBZh30YS4zmjKlareXpD7ho X-Received: by 2002:a50:ec8b:0:b0:486:6d75:9a0c with SMTP id e11-20020a50ec8b000000b004866d759a0cmr8808256edr.12.1672322702239; Thu, 29 Dec 2022 06:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672322702; cv=none; d=google.com; s=arc-20160816; b=vO0ZNOpZ68eL2n429BxJz2zArwvVDmLPN14hhHwK4JWUfYeQIQIZmgFc7K1tIrcUS1 0Uo9A+E3ZfnO4ImX8yU7JyvhJM7rndDB7YXwNclGSwxDHpC7oqDo2bl2r/uBL75HGDzG keDdsmPVxmedRczqT1Y9l6k/HqaQJ90JvJC0aUctjoMcBDosehs4ZQ6NogbS83AGjGnA WdkMhTrI3OKHKJMMvkUZCYG4mXSF2kRjg0fRBaAM0rRhCNzdlPyE9hGSpya3JpObJNty E8+NyQLtpFVTY34dLjbvGHj4RZix3ZX/orSb0gGWRlDDcpf3lVCQt2Q4LcLUylSkRsCK v0hQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm6-20020a05640222c600b0046c5b0dfea1si14203104edb.625.2022.12.29.06.04.47; Thu, 29 Dec 2022 06:05:02 -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 + 61 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 Content-Transfer-Encoding: 8bit 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 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; } -- 2.34.1