From: wu000273@umn.edu
To: svarbanov@mm-sol.com
Cc: agross@kernel.org, bjorn.andersson@linaro.org,
lorenzo.pieralisi@arm.com, robh@kernel.org, helgaas@google.com,
p.zabel@pengutronix.de, linux-pci@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Markus.Elfring@web.de, kjlu@umn.edu, wu000273@umn.edu
Subject: [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe().
Date: Tue, 26 May 2020 21:55:31 -0500 [thread overview]
Message-ID: <20200527025531.32357-1-wu000273@umn.edu> (raw)
From: Qiushi Wu <wu000273@umn.edu>
This function contained improvable implementation details according to
exception handling.
1. pm_runtime_put() should be called after pm_runtime_get_sync() failed,
because the reference count will be increased despite of the failure.
Thus add the missed function call.
2. pm_runtime_disable() are called twice, after the call of phy_init() and
dw_pcie_host_init() failed. Thus remove redundant function calls.
Fixes: 6e5da6f7d824 ("PCI: qcom: Fix error handling in runtime PM support")
Co-developed-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
---
V2: words adjustments and fix some typos
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 138e1a2d21cc..10393ab607bf 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1340,8 +1340,7 @@ static int qcom_pcie_probe(struct platform_device *pdev)
pm_runtime_enable(dev);
ret = pm_runtime_get_sync(dev);
if (ret < 0) {
- pm_runtime_disable(dev);
- return ret;
+ goto err_pm_runtime_put;
}
pci->dev = dev;
@@ -1401,7 +1400,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
ret = phy_init(pcie->phy);
if (ret) {
- pm_runtime_disable(&pdev->dev);
goto err_pm_runtime_put;
}
@@ -1410,7 +1408,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
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;
}
--
2.17.1
next reply other threads:[~2020-05-27 2:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-27 2:55 wu000273 [this message]
2020-05-27 5:38 ` [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe() Markus Elfring
2020-07-08 15:24 ` Lorenzo Pieralisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200527025531.32357-1-wu000273@umn.edu \
--to=wu000273@umn.edu \
--cc=Markus.Elfring@web.de \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=helgaas@google.com \
--cc=kjlu@umn.edu \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=svarbanov@mm-sol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.