* [PATCH] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()'
@ 2021-11-06 17:44 Christophe JAILLET
2021-11-10 7:15 ` Stephen Boyd
2021-11-29 13:30 ` Lorenzo Pieralisi
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-11-06 17:44 UTC (permalink / raw)
To: agross, bjorn.andersson, svarbanov, lorenzo.pieralisi, robh, kw,
bhelgaas, pmaliset, swboyd
Cc: linux-arm-msm, linux-pci, linux-kernel, kernel-janitors,
Christophe JAILLET
If 'of_device_get_match_data()' fails, previous 'pm_runtime_get_sync()/
pm_runtime_enable()' should be undone.
To fix it, the easiest is to move this block of code before the memory
allocations and the pm_runtime_xxx calls.
Fixes: b89ff410253d ("PCI: qcom: Replace ops with struct pcie_cfg in pcie match data")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/pci/controller/dwc/pcie-qcom.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 1c3d1116bb60..baae67f71ba8 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1534,6 +1534,12 @@ static int qcom_pcie_probe(struct platform_device *pdev)
const struct qcom_pcie_cfg *pcie_cfg;
int ret;
+ pcie_cfg = of_device_get_match_data(dev);
+ if (!pcie_cfg || !pcie_cfg->ops) {
+ dev_err(dev, "Invalid platform data\n");
+ return -EINVAL;
+ }
+
pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
if (!pcie)
return -ENOMEM;
@@ -1553,12 +1559,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
pcie->pci = pci;
- pcie_cfg = of_device_get_match_data(dev);
- if (!pcie_cfg || !pcie_cfg->ops) {
- dev_err(dev, "Invalid platform data\n");
- return -EINVAL;
- }
-
pcie->ops = pcie_cfg->ops;
pcie->pipe_clk_need_muxing = pcie_cfg->pipe_clk_need_muxing;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()'
2021-11-06 17:44 [PATCH] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()' Christophe JAILLET
@ 2021-11-10 7:15 ` Stephen Boyd
2021-11-29 13:30 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2021-11-10 7:15 UTC (permalink / raw)
To: Christophe JAILLET, agross, bhelgaas, bjorn.andersson, kw,
lorenzo.pieralisi, pmaliset, robh, svarbanov
Cc: linux-arm-msm, linux-pci, linux-kernel, kernel-janitors
Quoting Christophe JAILLET (2021-11-06 10:44:52)
> If 'of_device_get_match_data()' fails, previous 'pm_runtime_get_sync()/
> pm_runtime_enable()' should be undone.
>
> To fix it, the easiest is to move this block of code before the memory
> allocations and the pm_runtime_xxx calls.
>
> Fixes: b89ff410253d ("PCI: qcom: Replace ops with struct pcie_cfg in pcie match data")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()'
2021-11-06 17:44 [PATCH] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()' Christophe JAILLET
2021-11-10 7:15 ` Stephen Boyd
@ 2021-11-29 13:30 ` Lorenzo Pieralisi
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2021-11-29 13:30 UTC (permalink / raw)
To: kw, bhelgaas, swboyd, robh, svarbanov, agross,
Christophe JAILLET, pmaliset, bjorn.andersson
Cc: Lorenzo Pieralisi, kernel-janitors, linux-kernel, linux-arm-msm,
linux-pci
On Sat, 6 Nov 2021 18:44:52 +0100, Christophe JAILLET wrote:
> If 'of_device_get_match_data()' fails, previous 'pm_runtime_get_sync()/
> pm_runtime_enable()' should be undone.
>
> To fix it, the easiest is to move this block of code before the memory
> allocations and the pm_runtime_xxx calls.
>
>
> [...]
Applied to pci/qcom, thanks!
[1/1] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()'
https://git.kernel.org/lpieralisi/pci/c/4e0e90539b
Thanks,
Lorenzo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-29 13:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06 17:44 [PATCH] PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()' Christophe JAILLET
2021-11-10 7:15 ` Stephen Boyd
2021-11-29 13:30 ` 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).