Skip to content

Commit 4e0e905

Browse files
tititiou36Lorenzo Pieralisi
authored andcommitted
PCI: qcom: Fix an error handling path in 'qcom_pcie_probe()'
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. Link: https://lore.kernel.org/r/4d03c636193f64907c8dacb17fa71ed05fd5f60c.1636220582.git.christophe.jaillet@wanadoo.fr Fixes: b89ff41 ("PCI: qcom: Replace ops with struct pcie_cfg in pcie match data") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Stephen Boyd <[email protected]>
1 parent fa55b7d commit 4e0e905

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,12 @@ static int qcom_pcie_probe(struct platform_device *pdev)
15341534
const struct qcom_pcie_cfg *pcie_cfg;
15351535
int ret;
15361536

1537+
pcie_cfg = of_device_get_match_data(dev);
1538+
if (!pcie_cfg || !pcie_cfg->ops) {
1539+
dev_err(dev, "Invalid platform data\n");
1540+
return -EINVAL;
1541+
}
1542+
15371543
pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
15381544
if (!pcie)
15391545
return -ENOMEM;
@@ -1553,12 +1559,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
15531559

15541560
pcie->pci = pci;
15551561

1556-
pcie_cfg = of_device_get_match_data(dev);
1557-
if (!pcie_cfg || !pcie_cfg->ops) {
1558-
dev_err(dev, "Invalid platform data\n");
1559-
return -EINVAL;
1560-
}
1561-
15621562
pcie->ops = pcie_cfg->ops;
15631563
pcie->pipe_clk_need_muxing = pcie_cfg->pipe_clk_need_muxing;
15641564

0 commit comments

Comments
 (0)