From patchwork Wed Nov 9 14:18:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 17583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp360672wru; Wed, 9 Nov 2022 06:21:40 -0800 (PST) X-Google-Smtp-Source: AMsMyM5VeGHRc3vEm8Cu0rrJbKAQWIWILWFRqCqPKpv8LZ2NRsFQdSu5se86SyHLAFyGhUVWIzoz X-Received: by 2002:a17:906:5a56:b0:7ad:c391:42ee with SMTP id my22-20020a1709065a5600b007adc39142eemr53119196ejc.127.1668003700298; Wed, 09 Nov 2022 06:21:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668003700; cv=none; d=google.com; s=arc-20160816; b=C9+XYblCfWHf96Vh3sSRciBoPWmI0m4Z1Q90A2lkdLVtR6oX0SY+hhma/fm3sLIzyo MuHemB9JQmTafdcnTJxeQGxsIT66DXWIv+VRizuZrHqn7TGCHkD3Sz0Nfdwh6k1qD6R2 XMYJNnWsPqYUIu5pJd255QBYD6geB/pgWFsj/4JgTDioJYpia3bI4bTBql/TiYt1h9Bw C4AAUBeZpo/c42YF/tCygMedYT89ncCUIhHqyuAEpLOt6NumxVOK4Ai7BzO+ofvVmEwh zedyrUAIsWqap/Z7QdtiFimJVOz400qYRGZPSeGolvTy0Zd8kEUMMIm/XEWNRd+mwoci i9cQ== 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=k3EpwzVmWOzCEKjlHybKoyyKiKdw/13nJEA6CHMat30=; b=R/V68oA1mEq3A+DzcOJggTwwdbTofqRnvfAYwe1d1Ug7wnf9BSOwspqH+Df2isXGc8 MCjFL0yWlyckYgBZNoxOyZsHQctPUz7vg5TJt3vDsOKs+9rVlKeRtN/hWlwp2F/EeS2Y C5KO5Ccwku9FlmTuietvLbl6RPffX+iBxriNpn0E2b+mUSx/fUrL/dkwOOlvskhfposb yq/OKeeQpboj29ESSdbMsg7SdAub+RnuUPBmIQYmd+r+8Z80YyzXfvMQlDssPB8VcnQI LPi2JfRUmq5w+xvd2AQPSu4YvKgwdqJxjyBJ6twi12kjSTRDkfK1U7+/X3euqsbt4Ko0 qS2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=o6tnVo96; 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 s2-20020a17090699c200b0078081036bdasi14353288ejn.501.2022.11.09.06.21.16; Wed, 09 Nov 2022 06:21:40 -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=o6tnVo96; 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 S231226AbiKIOUo (ORCPT + 99 others); Wed, 9 Nov 2022 09:20:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbiKIOUH (ORCPT ); Wed, 9 Nov 2022 09:20:07 -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 D21E61EEF7; Wed, 9 Nov 2022 06:19:47 -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 844EBFF80A; Wed, 9 Nov 2022 14:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1668003584; 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=k3EpwzVmWOzCEKjlHybKoyyKiKdw/13nJEA6CHMat30=; b=o6tnVo96a0eSlbSkQp8oYkb3vb9txGsF3WjNTB79swFuWe920qZYMHsmBqfDfe3y/cmNmB /CDOjMHZcErwRv4CAcP3g0uKnF4ZbXbNmh1vLZj3pxzflmTLOVseg6JOTsVoULzcXvU09/ ooqT9Gmo+IaGRDXYR6FgnwGRKrghqFuPnrg608ACwABOwIQKAIBEOb556nxet1W/syJpXm 54h5WKA393IEHyt8oJukRkp+QbT6+t5lGci5XqI8pfeRD+tJVoSj1jX7GGFKV2xj/iNgi3 smb4NQr3qFI1YoG/fA7Bpc2dOcBoV69O6o8Bo9BrlHNk/g8BoccJPTxmUAOTsQ== From: luca.ceresoli@bootlin.com To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans Verkuil , Dmitry Osipenko Cc: Luca Ceresoli , 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 , Richard Leitner Subject: [PATCH 10/23] staging: media: tegra-video: slightly simplify cleanup on errors Date: Wed, 9 Nov 2022 15:18:39 +0100 Message-Id: <20221109141852.729246-11-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221109141852.729246-1-luca.ceresoli@bootlin.com> References: <20221109141852.729246-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?1749028648488667167?= X-GMAIL-MSGID: =?utf-8?q?1749028648488667167?= From: Luca Ceresoli 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 --- 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 24de4ed1eaf0..2657207e5b7d 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; }