* [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe().
@ 2020-05-27 2:55 wu000273
2020-05-27 5:38 ` Markus Elfring
2020-07-08 15:24 ` Lorenzo Pieralisi
0 siblings, 2 replies; 3+ messages in thread
From: wu000273 @ 2020-05-27 2:55 UTC (permalink / raw)
To: svarbanov
Cc: agross, bjorn.andersson, lorenzo.pieralisi, robh, helgaas,
p.zabel, linux-pci, linux-arm-msm, linux-kernel, Markus.Elfring,
kjlu, wu000273
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe()
2020-05-27 2:55 [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe() wu000273
@ 2020-05-27 5:38 ` Markus Elfring
2020-07-08 15:24 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-05-27 5:38 UTC (permalink / raw)
To: Qiushi Wu, linux-pci, linux-arm-msm
Cc: Andy Gross, Bjorn Andersson, Bjorn Helgaas, Kangjie Lu,
Lorenzo Pieralisi, Philipp Zabel, Rob Herring, Stanimir Varbanov,
linux-kernel
> 1. pm_runtime_put() …
…
> 2. pm_runtime_disable() …
How do you think about to add blank lines for such enumeration items
and to indent the text below the numbers?
> Co-developed-by: Markus Elfring <Markus.Elfring@web.de>
Will our collaboration evolve in more ways besides patch review?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe().
2020-05-27 2:55 [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe() wu000273
2020-05-27 5:38 ` Markus Elfring
@ 2020-07-08 15:24 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-08 15:24 UTC (permalink / raw)
To: wu000273
Cc: svarbanov, agross, bjorn.andersson, robh, helgaas, p.zabel,
linux-pci, linux-arm-msm, linux-kernel, Markus.Elfring, kjlu
On Tue, May 26, 2020 at 09:55:31PM -0500, wu000273@umn.edu wrote:
> 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.
Can you send a patch fixing (2) based on my pci/runtime-pm branch:
git://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git
pci/runtime-pm
Note that (1) is fixed by
https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git/commit/?h=pci/runtime-pm&id=cb52a40202420d3886b84ea13dba699c9da13eb0
>
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-08 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 2:55 [PATCH V2] PCI: qcom: Improve exception handling in qcom_pcie_probe() wu000273
2020-05-27 5:38 ` Markus Elfring
2020-07-08 15:24 ` Lorenzo Pieralisi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).