From patchwork Wed Jul 3 18:02:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13722645 X-Patchwork-Delegate: kw@linux.com Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7CDA188CD5 for ; Wed, 3 Jul 2024 18:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; cv=none; b=snGZwe/KrIzgktUB7spejsWhnu7hKmRED/HqxbtXYn1BdJvHzCKCCHiCmESdYKJH06p3d06emKrsHCzX+MtAEbSbK6rODoIqg403goKtw2bF7FxpzLI+OiPULneadHVS7aZ22s/WPh9neCkpcfu4J86RbSY+79jsTkVv6sop4Ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720029792; c=relaxed/simple; bh=91VsNn8yGFqW7AJ+iVGDqY5OlAsafWKE4psQizyGPAQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=srXTpHMGSomMUdWB0us8+YqwO36hZ/FSox1Edt9VEEvnlerRyfGX7KIT/JexFRuOFpd9wBDhbCDJX7miuxQGKDJtJBa3yEMgdGrR+QqkkGZNJBI7exfBellSlAgyhRHEVBeDogA+Z4O2Mr3smbMqeB8xaSz4U9SH8ubqQ3oicw8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=K2r7osZu; arc=none smtp.client-ip=209.85.222.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="K2r7osZu" Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-79c0bbff48aso435262585a.1 for ; Wed, 03 Jul 2024 11:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029787; x=1720634587; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=34ctz7tk8U3Z5yRNWcs893lUpA9UxWthq1Ny6SEdBgw=; b=K2r7osZutoKUTks6/WxTznsTmtK2oednKuh3RjZRMR07kFKtgYm1nS6/CWID1SpKwX 4e3p9FbptQLqz15Xpm1Gbvf76rnBmnjgtojkjsSuVvHGwFn4lKfWds66DNv50gWjjIPF 8pgJhgk96uyT+J41BVqFL1pwkkTYkdcfBf6to= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720029787; x=1720634587; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=34ctz7tk8U3Z5yRNWcs893lUpA9UxWthq1Ny6SEdBgw=; b=LZxqyJXz5Xi2NjFFNfHlQKP43D0ItmArIIilNB7aPYAqGMRe49VsAPRvuuyga3vQtM 3yi5H/yA6s2dklyvEiQOQBx7yDE7k2NwzqjWCRiMLaGO9y7QPF2DO657Vzr7hU+wqnR1 4MwNDgBGSxCJ/HI+Ii90pz4p+1h79yNSCV3UdTjvgsX7+c041YEvzqTfZjWn1btLjGHs gqFP793uPPced2hJN/7rRRcDB5Us88caDHlPwwDsFbni3vUDmdOFofpTlFBX9CX8qwj2 wVoamnxmDS+c8DAIg6LCTW+OkAZK4RZcFqBog9Zx9qeD8asncFLYGXkV/DMPOZnsfgDa BnXA== X-Gm-Message-State: AOJu0YyActK1GOdF3lkwcn0gdXJHWS/iqblZUdRh0D9j3NthztOdJVpQ 2fMRp9uJ434l04nZ4mQONp5b5dy5r7437VOw2c+xEQV8a7VRgB1lzl1bseLtJoB1A5lsA0NZmxJ i7WzWVQobeNb9sVDJUSiHgKBro+ZbsavE63TT82nfJeJrd5WvHkBoZvj0wJRIzmAa3LStdpjKPq 2eW8To3xXfHIW8mEM6nCMcP/VqkOu6NAdspxYghz0lh24A0xGg X-Google-Smtp-Source: AGHT+IFXuw7cmg0WWrIFF051lnnYU9WCOItnYRzRjveFDrXAg2LZ5dgJsm5yAu5w/YAdJlWx84hg3A== X-Received: by 2002:a05:6214:20a7:b0:6b0:8e1d:f720 with SMTP id 6a1803df08f44-6b5b71ad1f2mr141051136d6.59.1720029787375; Wed, 03 Jul 2024 11:03:07 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b59e5f1a6dsm55589626d6.83.2024.07.03.11.03.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 11:03:06 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 02/12] PCI: brcmstb: Use "clk_out" error path label Date: Wed, 3 Jul 2024 14:02:46 -0400 Message-Id: <20240703180300.42959-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240703180300.42959-1-james.quinlan@broadcom.com> References: <20240703180300.42959-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Instead of invoking "clk_disable_unprepare(pcie->clk)" in a number of error paths, we can just use a "clk_out" label and goto the label after setting the return value. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c08683febdd4..c2eb29b886f7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1620,24 +1620,25 @@ static int brcm_pcie_probe(struct platform_device *pdev) } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); if (IS_ERR(pcie->rescal)) { - clk_disable_unprepare(pcie->clk); - return PTR_ERR(pcie->rescal); + ret = PTR_ERR(pcie->rescal); + goto clk_out; } pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst"); if (IS_ERR(pcie->perst_reset)) { - clk_disable_unprepare(pcie->clk); - return PTR_ERR(pcie->perst_reset); + ret = PTR_ERR(pcie->perst_reset); + goto clk_out; } ret = reset_control_reset(pcie->rescal); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); + goto clk_out; + } ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal); - clk_disable_unprepare(pcie->clk); - return ret; + goto clk_out; } ret = brcm_pcie_setup(pcie); @@ -1676,6 +1677,9 @@ static int brcm_pcie_probe(struct platform_device *pdev) return 0; +clk_out: + clk_disable_unprepare(pcie->clk); + return ret; fail: __brcm_pcie_remove(pcie); return ret;