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: 13722659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3503C30653 for ; Wed, 3 Jul 2024 18:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=g2FbvKney1QWp4c8ls7X1i1tvh9o9+TUWKKhDHwBL2U=; b=PlTD8fgx2jij/II/aHPVDTpnig T4JBmF462DD9CLdoBKrTlE+uT8rvLXnaJJC10YlWbfV1TUckGqhVmrMLDM+BJ8GFLJ8NnSnD3asUt mr/nqFwPy1HAkxlJF7LDJqZIceH7jbFKlOVlNhQHBQuDBKP8n98WMT1URL7h331zDro6FiviKde/K jcta9Uh3ydJq3tWL9yZVC6d7tIbov1nco2U0JbpWXYw7LH4Jo/fNp5gHcRn8QTF96OUyHjf2/+81q NCl8PC3h/BHC+6JrlrxJU4KyAt+4wnE5NDKwq9dnUdSULCQOK2EsO9N7TuYCiA8Z5W0piLb6Ym/PL uNczV+lA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Kd-0000000B5Mp-2ieO; Wed, 03 Jul 2024 18:03:51 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sP4Jx-0000000B4xL-0Z6S for linux-arm-kernel@lists.infradead.org; Wed, 03 Jul 2024 18:03:11 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-6b553b1a159so28099786d6.0 for ; Wed, 03 Jul 2024 11:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1720029787; x=1720634587; darn=lists.infradead.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=g2FbvKney1QWp4c8ls7X1i1tvh9o9+TUWKKhDHwBL2U=; b=gfiZ6MLJcUTpvdtuwsjtu6bi6yuLjDmlLYnsTSbHkftfEmEKWFn8n1yV92ekDuJ6Yg l51Ikc8rSS0tgxZd+xGdJPR+CcmGOfS3iqnQ/ExRRKfLpWS0QfLf7pyePA5cYYOLbXos AQ1q2w4bBX+lRmNy9JQYd/AHr4miZALiEskW8= 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=g2FbvKney1QWp4c8ls7X1i1tvh9o9+TUWKKhDHwBL2U=; b=kYQ7MydJVR+m9gtrm0J5ctLcOekvMIatbYLBPuWEhvrd+WZNGlEYbhPG9qaWH9waYT caj0mtqetZekdq2OcWqLOAljTFrVrEpBE4kVh/Tqtac9vyic3kBFKMaLQynZPLmtG9Sf clJQGUtjALwxnSpBAU3sbaQFy/SYwDREuO5xLBNev7recZxRSwjIh+BqnCN3nsLyBu1+ JjldDvO4KF9kO2ECH8fwSKckdSutqGT7Td6bYzHVz9S0touuhVMVHrlksVPKTTryQFAl uQVsQZe5UzowOJXOOhx2wQC7W4TL5Z+/MX8+JXG+cPYy1FCpotlXGJRgdhyd4hs8qLLL P1Sg== X-Forwarded-Encrypted: i=1; AJvYcCWLY+KLczAbpVzWkEFnCaC9hLpoRQ+EEDdwKcIwKndOB23zbHW0pb2ihvC+/6j4GqDFlk6xZe+BymYuKIr8UJH4qA0u9mp858ykksCnbETdNp96U6w= X-Gm-Message-State: AOJu0YysuF7GRARPjhdZMrkcwJtUOQS428Fr0kPZdbOxDvif3oJC0kmo klj2wklYZMlOV6c0NLwpyAC/JaHDSOKNSIwhNYMhV1z9Iq4qY0IPiA0y6+91HA== 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240703_110309_204628_8E42C74D X-CRM114-Status: GOOD ( 12.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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;