From patchwork Fri Apr 7 13:38:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 80831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp299132vqo; Fri, 7 Apr 2023 06:51:09 -0700 (PDT) X-Google-Smtp-Source: AKy350YgMcDju7/r547nIC7EK2m6LRXakSodAGo3rKcpVzmRWt+AstT4ptAtrp4kVIgb7cv6EEnX X-Received: by 2002:a17:903:284c:b0:1a3:d4c7:365f with SMTP id kq12-20020a170903284c00b001a3d4c7365fmr2547009plb.34.1680875468974; Fri, 07 Apr 2023 06:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680875468; cv=none; d=google.com; s=arc-20160816; b=Yjz8SRHI1bC1uCx2J4Pyt7G/JUFzH3gkSdHpSnLyVukz+WbvJrw3PZg/0RkgQoCF/3 TjPqYiBN08UjDDBgaZDvp/SQGMxXUWwbPcJkqjqluY5erNLFKAkP/2GYfqB1QGrwYl2L h6oaZbPGEsCSa8KmsIUmxtGC5JacBHYBGYxzReyvxiaXs9zzxobSmTLUKiiYVPj+Jz/U SpgYcVVF2GoM73X2PiGpGKagjEmZ5KzulyfrsPuIgeuKRvnGlWgeMRzvh34AJRR4ZMyD MmQ+Stzq1TdMDHywjV2+Rnq095u3v0mzxRHmld6yKazjktyDjueQZpfmHZqMgAawfkJd S+Dg== 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=PLj+HTnVwetVKCJYGoFXl8GPfSvVBH6A468cry27oag=; b=HH5rAzhOTVVo2WHvJoFqkEX/fJug2rQmH95XZSySAanQMRdPKbO1fKL2EMuLVPjNu+ RdNNVvfCUihXk1eT2e/uyvwJqQtA4WWXBr1E5XIhtmVB9hyWLMnLC0KUEwPu2j2qqgYa wbOPNs5Gv9NyMOa7QAQuUEfplIQiuxQohtwHn80z9022NRNhSu/BTMmEICqV43rHU9nW qo6T54z1z+hOV+WRX/vX/mm42hKQC9IoqFw301jRIVlf6SYy0dFglj8gIj8+GMmkrOg2 GFs4557IrEPEQ/uMZJVEnbnx98tLyfRZLcwOJ3Bkp9dWg83+L1Y7cKeJHjqi9UjA1tpe piTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Q161tZV+; 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 kq14-20020a170903284e00b001a1f9f4cf26si3679787plb.545.2023.04.07.06.50.55; Fri, 07 Apr 2023 06:51:08 -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=Q161tZV+; 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 S240896AbjDGNlR (ORCPT + 99 others); Fri, 7 Apr 2023 09:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240698AbjDGNkw (ORCPT ); Fri, 7 Apr 2023 09:40:52 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8F75AD3C; Fri, 7 Apr 2023 06:39:54 -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 213161BF20E; Fri, 7 Apr 2023 13:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1680874793; 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=PLj+HTnVwetVKCJYGoFXl8GPfSvVBH6A468cry27oag=; b=Q161tZV+jeLOXvhQkBerEA1g5pxQ9hbaarPBua7Vxnwx7xhJtnpuFjPhHAGF6Akytc0Hf3 erPQMOM/h5zCQTLTT/Sr0gAn1XDQCGa5FBvUB1U6C5T1nKed49RiLv+/w6064U1u3W2Mbi F6/zvcmjnCQQNWeSfOmOHIQfjkWIja4zH2yx/TIJYUWwOL+pPNRY4ntwbCSqxAkbtgxlsU DSUgCyrdB91T595fSnGmNdZjKdw6E4LIbPJPIiiosrkIhtEVnpIOeQwb8mvt9MvqHLmzdx I3nX3fzaNjHPjXTQ/daBFcDHQDz8ibxhSvH6Lt0Z5v1UneITFF2gteKUJ2l0mA== 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 v5 07/20] staging: media: tegra-video: slightly simplify cleanup on errors Date: Fri, 7 Apr 2023 15:38:39 +0200 Message-Id: <20230407133852.2850145-8-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230407133852.2850145-1-luca.ceresoli@bootlin.com> References: <20230407133852.2850145-1-luca.ceresoli@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762525675847793583?= X-GMAIL-MSGID: =?utf-8?q?1762525675847793583?= 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 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; }