From patchwork Fri Apr 1 12:10:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12798237 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73A56C4167D for ; Fri, 1 Apr 2022 12:12:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345771AbiDAMNw (ORCPT ); Fri, 1 Apr 2022 08:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245312AbiDAMNv (ORCPT ); Fri, 1 Apr 2022 08:13:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 669FE276FBA; Fri, 1 Apr 2022 05:12:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03D1F6198A; Fri, 1 Apr 2022 12:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C76EC2BBE4; Fri, 1 Apr 2022 12:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648815120; bh=t9eGMpJUVEKROPnLz05s5+olV1a9bFHicuFFZxP+Qh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjYoL2519OSX7II0irGkZbL3pB0mQvOFPQoFH1wKxZyh8XvIqHzgRUiT3sxcZxCGj 7HHOqv41NYd6QJ/QjWaieSIK/yWPIrGcKpGxjbxUobDbwev1CB0GVjfaGT6w3QNetZ fYz3WMXjEle9UmXPCLcH3toKtinFE6WhBc0Zkr8x5/bbmiuyyyjZNzcqy41ii+3e2y +I8P5Av2VgHrBoXa3L4FE+FNKvgWP1DgheES/r2QAzekvJ8xKsTdWHbu/+FO2iQgjt 9Us9kT99AnPoY41VKCem+BfAWZmxwSq+O1M80qd0msmCGo7jUSe1A7PfKwNbK6g6IZ OOvph/GG+JMUA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1naG8G-0001dM-Ad; Fri, 01 Apr 2022 14:12:00 +0200 From: Johan Hovold To: Lorenzo Pieralisi , Stanimir Varbanov , Andy Gross , Bjorn Andersson Cc: Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dmitry Baryshkov , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 1/2] PCI: qcom: fix runtime PM imbalance on probe errors Date: Fri, 1 Apr 2022 14:10:53 +0200 Message-Id: <20220401121054.6205-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401121054.6205-1-johan+linaro@kernel.org> References: <20220401121054.6205-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Drop the leftover pm_runtime_disable() calls from the late probe error paths that would, for example, prevent runtime PM from being reenabled after a probe deferral. Fixes: 6e5da6f7d824 ("PCI: qcom: Fix error handling in runtime PM support") Cc: stable@vger.kernel.org # 4.20 Cc: Bjorn Andersson Signed-off-by: Johan Hovold --- drivers/pci/controller/dwc/pcie-qcom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 20a0e6533a1c..0b0bd71f1bd2 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1616,17 +1616,14 @@ static int qcom_pcie_probe(struct platform_device *pdev) pp->ops = &qcom_pcie_dw_ops; ret = phy_init(pcie->phy); - if (ret) { - pm_runtime_disable(&pdev->dev); + if (ret) goto err_pm_runtime_put; - } platform_set_drvdata(pdev, pcie); ret = dw_pcie_host_init(pp); if (ret) { dev_err(dev, "cannot initialize host\n"); - pm_runtime_disable(&pdev->dev); goto err_pm_runtime_put; } From patchwork Fri Apr 1 12:10:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 12798235 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D191EC433FE for ; Fri, 1 Apr 2022 12:12:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345733AbiDAMNv (ORCPT ); Fri, 1 Apr 2022 08:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345596AbiDAMNv (ORCPT ); Fri, 1 Apr 2022 08:13:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96388277942; Fri, 1 Apr 2022 05:12:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29236619A3; Fri, 1 Apr 2022 12:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75431C34113; Fri, 1 Apr 2022 12:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648815120; bh=d0HYYSzBFiO0QLVb9RS/N/6MxRm6wrny8ms762htYcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EDmZfqd32cjmkFbdHYnUqt6WfaCkfG4YZLT01LPwPrV+Xoe/nHmKZiJkFEyh0Pz9j 2Sa3CXG9kAeyGZZ2GQKd4eS6HS1H9BbyU7eBbAYPXANO1jO0Tn5/R4t0bH5EpBwemr 296B4sa1LqArG6LQncXsb6vONSBr9GujVQiWkhSnH2Vf/Z5lUWwemdod4s4cD3Mz2m tDjxQlHFib5P/4Bcwx8usAP2/vlLg6NqxKVlUMJp/nKfx3uzeqzI2cPTKxjlB828RL 0jY8nd+q7ksSnBW4bwOuMgT4ZpvtsFbjyZxjKborUKq/30Y5Au/A9XJnnaeuWLUoQc HQZcU9ARguwaw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1naG8G-0001dO-Da; Fri, 01 Apr 2022 14:12:00 +0200 From: Johan Hovold To: Lorenzo Pieralisi , Stanimir Varbanov , Andy Gross , Bjorn Andersson Cc: Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Dmitry Baryshkov , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH 2/2] PCI: qcom: fix unbalanced phy init on probe errors Date: Fri, 1 Apr 2022 14:10:54 +0200 Message-Id: <20220401121054.6205-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401121054.6205-1-johan+linaro@kernel.org> References: <20220401121054.6205-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make sure to undo the PHY initialisation (e.g. balance runtime PM) in case host initialisation fails during probe. Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver") Cc: stable@vger.kernel.org # 4.5 Cc: Stanimir Varbanov Signed-off-by: Johan Hovold --- drivers/pci/controller/dwc/pcie-qcom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 0b0bd71f1bd2..df47986bda29 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1624,11 +1624,13 @@ static int qcom_pcie_probe(struct platform_device *pdev) ret = dw_pcie_host_init(pp); if (ret) { dev_err(dev, "cannot initialize host\n"); - goto err_pm_runtime_put; + goto err_phy_exit; } return 0; +err_phy_exit: + phy_exit(pcie->phy); err_pm_runtime_put: pm_runtime_put(dev); pm_runtime_disable(dev);