From patchwork Fri Apr 1 13:38: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: 12798310 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 27F30C433FE for ; Fri, 1 Apr 2022 13:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346427AbiDANla (ORCPT ); Fri, 1 Apr 2022 09:41:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346420AbiDANl3 (ORCPT ); Fri, 1 Apr 2022 09:41:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17DA637A02; Fri, 1 Apr 2022 06:39:40 -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 ams.source.kernel.org (Postfix) with ESMTPS id BFAC2B824FB; Fri, 1 Apr 2022 13:39:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F58AC34110; Fri, 1 Apr 2022 13:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648820377; bh=t9eGMpJUVEKROPnLz05s5+olV1a9bFHicuFFZxP+Qh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gKEdt5uH5NduAHIbRNvwF/dP1bYkSHqdU/1TDyhirTw7XfGmNB1z21U3VdbNF+eJQ BCNSqEITdJPgyhidk3cAv6A2SFQ3ArLUuLRgs7Zn7ntOpHFnQENoFk7wjHSVZvKR8L zSr6ukLQOG9WdHBq8gCnvyhyHAGmKQ9bNcbRFGDur1S6Fy16xrBMvbIfTF1hENF64r FhbP23Odc13W11IKNOYOeeOVpHn6rF5cOqEixatiIoLTLByxFfMwmbmEIkLxVWE0Zm GqWVose2KE6P76f64B9kFKD8s9/dOeMhIs5fi0a2BaLaxCCm+1PfReAtAYAJa/mTLv Zqedr9QtMUuMg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1naHV3-0002kQ-Od; Fri, 01 Apr 2022 15:39:37 +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 v2 1/2] PCI: qcom: Fix runtime PM imbalance on probe errors Date: Fri, 1 Apr 2022 15:38:53 +0200 Message-Id: <20220401133854.10421-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401133854.10421-1-johan+linaro@kernel.org> References: <20220401133854.10421-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 Reviewed-by: Manivannan Sadhasivam --- 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 13:38: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: 12798311 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 5E0AAC43219 for ; Fri, 1 Apr 2022 13:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346433AbiDANlb (ORCPT ); Fri, 1 Apr 2022 09:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346421AbiDANl3 (ORCPT ); Fri, 1 Apr 2022 09:41:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137E2377EC; Fri, 1 Apr 2022 06:39:40 -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 ams.source.kernel.org (Postfix) with ESMTPS id C82A5B824FC; Fri, 1 Apr 2022 13:39:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C567C34111; Fri, 1 Apr 2022 13:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648820377; bh=d0HYYSzBFiO0QLVb9RS/N/6MxRm6wrny8ms762htYcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VRC13yr1gIPBER1tskAq3wkJXADYdIKDycf5He/+4t3FGoVjKP2u9bmZEJW3G/lsa xP3rQFFhZEWj/YtPn6izHtNtDwKCVc60+pz1gpuTLsPZIlxV5nY1lv4faSqIwRNPQQ v9HoW2+/Jz4Nm4hjQDE44wZ8y1MGMN157XQDbgoJkE0P+a6accW/f4ao6ETSbazf/9 RS6DAi9bsk42wM8bfqNA8dCGQlHFNntXcmBiP5vUwYdsDjftPighARN1xOZl/T3d1x P7QZctG4PTuGTaGFgyhmJfwksmP6N2IHnWpKo56YkDqdNqkFjr+Ue4gK+uFkxl/xSr 9UtrKtYRb+kSw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1naHV3-0002kc-R7; Fri, 01 Apr 2022 15:39:37 +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 v2 2/2] PCI: qcom: Fix unbalanced PHY init on probe errors Date: Fri, 1 Apr 2022 15:38:54 +0200 Message-Id: <20220401133854.10421-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220401133854.10421-1-johan+linaro@kernel.org> References: <20220401133854.10421-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 Reviewed-by: Manivannan Sadhasivam --- 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);