From patchwork Mon Nov 28 15:23:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 26826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5750349wrr; Mon, 28 Nov 2022 07:28:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf61qg98KlAjwxLxi6HmoV7bhWJCVsrT+Z39GP0OBqeUPf/Qa88BI3xm9QD3MY3QqTOBoxEl X-Received: by 2002:a17:907:a705:b0:78d:3e6b:d402 with SMTP id vw5-20020a170907a70500b0078d3e6bd402mr27942213ejc.563.1669649300026; Mon, 28 Nov 2022 07:28:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669649300; cv=none; d=google.com; s=arc-20160816; b=Qmm8auZlwt+/pZoib2WQxoSjp0OFhs5lmYXxnQAIK/CXvWqDOTnyEMjsFJcClIaPmZ HlVFO86e7Us63wgRysXxuvJDLAQKDmOg5ZQaBrdBiiMLo+6w2SfEkT8a7x6dI0twPXAR YXSTMaU/wvvRegdWjZhEdACjxwDiVPH0XXjRD8z5m86ynL+vRlzCr5/tmeQSmox4NY4y 4e6rqK3hhXUoqqoi3amQCuy2m1tq6qx+FLWuikfEF/FM2tpPAue9xtR9+GE0Vq+k/kil lZOm4tEeVEJN8K/yQpGKge1+67sW3EhnAygFMLgrFI5giSMXYmRnbnYe3jymXJycoD6U 1lVw== 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=eZduwFmDHtlgeg2+JJFukQVp7zp/Hiu/ppOmNookfL8=; b=P4SWVME9lJeoc7/c7pO+LQiwDnJkYIJWh8oc0BFP7kkUhMi+ijiZrO0CMiRkUysoNo v/tMy5UJw0KBG4Lc1sPvWglEXLwAcLpPF3dqtY+gI/7mSfXlMR+sKAMftwiC/sNiUx/f UDU3gY/KNAimTR8jhAq4pm5s+1w4BefsqqPe+rhMkJmAwZxhn6h79Ut+swupGJ9XRNo/ 1VDzRyWaBVu4j3Za3wm24l2f2Owj4e6ZlfkWbbXCHjzRkCq2Np+6o/trZ1tHcaiHLxam 3HFztzXR6QnXJ+V21XCYexNOP+6Yygj5aza/Ccqk2+lTsfP0c0EEq7VjRwKO821gLdJa hkww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=QOEPE5eR; 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 dr17-20020a170907721100b0078decbc3f73si10489375ejc.460.2022.11.28.07.27.53; Mon, 28 Nov 2022 07:28:20 -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=QOEPE5eR; 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 S232037AbiK1P0i (ORCPT + 99 others); Mon, 28 Nov 2022 10:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbiK1P0K (ORCPT ); Mon, 28 Nov 2022 10:26:10 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABA5223384; Mon, 28 Nov 2022 07:24:50 -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 69BC3100008; Mon, 28 Nov 2022 15:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669649089; 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=eZduwFmDHtlgeg2+JJFukQVp7zp/Hiu/ppOmNookfL8=; b=QOEPE5eRfqnQ3j613rQ7mMZuJ/rFEB12Hl+JJqJQOH9Z+xA15tht4tK6thY9dHGLiU7ZC7 y5+PiJhtcy4noYvoSyj8giSSz1v2hn6qDVReFuSM1eFZ7kio8JnxsqfUv5z1OKzJSO4emr giBxKdtqbeDivPv8IkgDVH/EsO2kWA1c6I725kyByrWjuMyiwxCosFsMTS6x+dHGoLB2sU 0XGHpKzIE4rZi+PSTW4EmJS8JoEdl2LLMcN1ajlHNN7GZ20WalhBwyw1306Foo/3EmpNg3 21EMsfQg7U0HtuBEnHN9zlSK6kc33eLVkeOhOiVy7gYTNACuu6ZpkVTIpVeH9w== From: Luca Ceresoli To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Mauro Carvalho Chehab , Greg Kroah-Hartman , Dmitry Osipenko , Hans Verkuil 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 , Paul Kocialkowski , Richard Leitner Subject: [PATCH v2 08/21] staging: media: tegra-video: slightly simplify cleanup on errors Date: Mon, 28 Nov 2022 16:23:23 +0100 Message-Id: <20221128152336.133953-9-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128152336.133953-1-luca.ceresoli@bootlin.com> References: <20221128152336.133953-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?1750754184700519579?= X-GMAIL-MSGID: =?utf-8?q?1750754184700519579?= 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 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 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; }