From patchwork Thu Oct 1 15:18:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 11811659 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 965286CA for ; Thu, 1 Oct 2020 15:18:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6016D21D92 for ; Thu, 1 Oct 2020 15:18:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bVRxYTwP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732391AbgJAPS2 (ORCPT ); Thu, 1 Oct 2020 11:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732346AbgJAPS2 (ORCPT ); Thu, 1 Oct 2020 11:18:28 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D71CC0613E2 for ; Thu, 1 Oct 2020 08:18:28 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id q4so2142360pjh.5 for ; Thu, 01 Oct 2020 08:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=/j+RdkbWAoLmcyARbB0ArBhuw7myGTxRF9wQxnpf0tM=; b=bVRxYTwPrtZzz9f6rdcc2elwcoZMBtwqQ/z72Tagt0MZmuFakMgmSws/mOORvZlD8K eoR7qEN2d3/olJclEcVQIcSjYIz0Nh8PhB8FHmkauxenpZrN6/Xl/M6UjirjBW4zuvh2 JfoULz+2s4p2WYNlxo2k5A8fqluwUhZEv8rec= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/j+RdkbWAoLmcyARbB0ArBhuw7myGTxRF9wQxnpf0tM=; b=pbVo5kcf1LnrbdlGNXu3M/IYy9JclB5/gFOxlv70QUlSQiFDmKalys5+HbDyEzisOw kehD95DplMW6SfpxkTePlUfZeV/4/h7pxjuNXvZJyj7+51h/tn5mz8K4GuOGkrLJrgc6 6/FHCUrUZtS/yV7UTF57zDyLtWKAvOVJG23EpU7zdpLz9iZVPJD820pvS7CnYVUrwm5L k+YZ8Z6tcpzCMz/4ikJj62tOmzMWyFLMlRz3dPK83UYCVFLgyZcoI3i0SbFnK+Vso3Vo xpSKPy7iInRmIWvZRVbpCj+iDC9gpdk65emFWPJfos0SiPqbwWKC1iT32C3nEZe4ru7c Jjpw== X-Gm-Message-State: AOAM533Znk9v5NKLlOeCvP+VzxiLNGiVsAfZNbFSOIcAkHCUJDkdTxoh S9xnnT1JnS3DoplYS4WI49wTyQ== X-Google-Smtp-Source: ABdhPJwTxDRaJxnOkim6qM7bk0kRNLhejNxL1G4XRcYuNfl80PLDGPRZWcTo1N3Y44FSkDiUcyHowg== X-Received: by 2002:a17:90a:9403:: with SMTP id r3mr493762pjo.52.1601565507574; Thu, 01 Oct 2020 08:18:27 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id f4sm6266737pfj.147.2020.10.01.08.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 08:18:26 -0700 (PDT) From: Jim Quinlan To: Dan Carpenter , Lorenzo Pieralisi , Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com Cc: Rob Herring , Bjorn Helgaas , Florian Fainelli , Jim Quinlan , 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-pci@vger.kernel.org (open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1] PCI: brcmstb: fix error return paths in probe() Date: Thu, 1 Oct 2020 11:18:21 -0400 Message-Id: <20201001151821.27575-1-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Fixes two cases where we were returning without calling clk_disable_unprepare(). Although there is a common place to go on probe() errors (the 'fail' label), one can only jump there after executing brcm_pcie_setup(), so we have to add clk_disable_unprepare() calls to the two error paths. Fixes: b98f52bc6495 ("PCI: brcmstb: Add control of rescal reset") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli Reviewed-by: Nicolas Saenz Julienne --- drivers/pci/controller/pcie-brcmstb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 6e7aa82a54a3..da2fefe80d47 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1269,8 +1269,10 @@ static int brcm_pcie_probe(struct platform_device *pdev) return ret; } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); - if (IS_ERR(pcie->rescal)) + if (IS_ERR(pcie->rescal)) { + clk_disable_unprepare(pcie->clk); return PTR_ERR(pcie->rescal); + } ret = reset_control_deassert(pcie->rescal); if (ret) @@ -1279,6 +1281,7 @@ static int brcm_pcie_probe(struct platform_device *pdev) ret = brcm_phy_start(pcie); if (ret) { reset_control_assert(pcie->rescal); + clk_disable_unprepare(pcie->clk); return ret; }