From patchwork Tue Apr 18 08:00:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 84649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2663859vqo; Tue, 18 Apr 2023 01:04:17 -0700 (PDT) X-Google-Smtp-Source: AKy350bXlxC1pc7NGyElAr8GHwUneO3SoAUrkyXhDsCHspfprID3MgpGPw+yvXAjXg8Y7XB/qUqH X-Received: by 2002:a05:6a20:841e:b0:ee:af32:754b with SMTP id c30-20020a056a20841e00b000eeaf32754bmr16272705pzd.2.1681805057774; Tue, 18 Apr 2023 01:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681805057; cv=none; d=google.com; s=arc-20160816; b=Y6gqzSQWyN3OdhlT5J5IgwHPa7vqXxnm9eA3FR6uGucpNvZ0/ig7u9/2gI05UiD7n8 dfqpiPkY0EiffFgsqNA+ygk/kQS2WX1mUimOcAkNzjSJBe7BxUq1Aoxb+bdxpcGqbsMV Ny1Lb34VFcNzP8Ta5sZcJ0k4b4aNDoq5yFIlAED0sRZrdwFqXeO0eJ8Q12QF8A3JpA3j dEC6Q5Sk03pv0nXONGUvi7EGSNRJhIKekIi3BdZRLnLPO5PTA/avAF6DtpG9zO8Bwbv2 /FPlAkyjZfXEohR2ylQbtnrBC6Bb+f1fqnT5d4D++JfkByjH20vmi35SP8imvSc3o4T0 y+xA== 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=p+VzAfaSqgxKGJT/6W+d7FGRqtXq2O0GiseDQOgCfqU=; b=WJk0O6xDFT9XXMb14FQko2srbz2UF/vwYNHWy9f3LSf/haincFFH7Hnn2ajNg5vRTy zVMq32BFgxGFCdovcIdkEjtaTa2U062KkvJjy5DTv7wsjzGuU6lBUSCdLN6XpDVTZ9iz ThRYH6OXyVlwfbgJgdjWK/pHDO8aZwknbQED61EdRrdOSmVLSYQkn4arKzY/Ywal6kKG t/tDUvMWMV6+9zLt5TdISdCgpC4ezGgu0n4ccu0x5v1rtSweoYQzWDxZBQwOLq+KW9ZW SQy132M/ndKw0hqrVOGUaCLcEErRgblYY/HWiMoPYyEE3PIDZG1DO8MqK1sVEx2QuSvS FOvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CGSJMVEf; 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 i63-20020a638742000000b0051f6011778esi895518pge.501.2023.04.18.01.04.05; Tue, 18 Apr 2023 01:04:17 -0700 (PDT) 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=CGSJMVEf; 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 S231531AbjDRICj (ORCPT + 99 others); Tue, 18 Apr 2023 04:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231458AbjDRICM (ORCPT ); Tue, 18 Apr 2023 04:02:12 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ABB18684; Tue, 18 Apr 2023 01:01:35 -0700 (PDT) Received: from booty.fritz.box (unknown [77.244.183.192]) (Authenticated sender: luca.ceresoli@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 84CE824000B; Tue, 18 Apr 2023 08:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1681804890; 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=p+VzAfaSqgxKGJT/6W+d7FGRqtXq2O0GiseDQOgCfqU=; b=CGSJMVEfNn8zDkV84d82TAiUJl2y5+Pwo1O9aV9Ce6AJUmPS1EFtWXRwjBkjvUpbugSmJF gWNi3LaMjt3p0GQ1boGQjjxiRUhwx0e1IVVbR7U82AwdGKH9DRehcs9Qf0Q5uvaPNNYp53 LBwqkFoviljVP5xY31IOwLko5O0Y2bEwke3syBsV21u6A75adHeimqpA7r0Y3at6Kj2tRU rxMP8LdJ3mFOz6Ll0PnuOdpJaaZ3sMNKH/bFqvduwga4so63TVUXUK9xPChmKRrjYecbBt w5mwIpP+OXS7y1YT0hCEpk6JM31QPYZPS/HVg/RcmtRji64IiXrR/r3EfatQHg== From: Luca Ceresoli To: linux-tegra@vger.kernel.org Cc: Luca Ceresoli , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Laurent Pinchart , Hans Verkuil , Thomas Petazzoni , Paul Kocialkowski , Richard Leitner , Dmitry Osipenko Subject: [PATCH v6 07/20] staging: media: tegra-video: slightly simplify cleanup on errors Date: Tue, 18 Apr 2023 10:00:41 +0200 Message-Id: <20230418080054.452955-8-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418080054.452955-1-luca.ceresoli@bootlin.com> References: <20230418080054.452955-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,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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?1763500420082009659?= X-GMAIL-MSGID: =?utf-8?q?1763500420082009659?= 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 Reviewed-by: Dmitry Osipenko --- No changes in v6 No changes in v5 Changed in v4: - Added review tags 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 1c0424bf1ab0..ce4ff4cbf587 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -1352,7 +1352,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 }; @@ -1375,7 +1375,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; } @@ -1398,13 +1397,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; }