mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-15 05:39:39 +02:00
PCI: xilinx-nwl: Clean up clock on probe failure/removal
[ Upstream commitcfd6790397
] Make sure we turn off the clock on probe failure and device removal. Fixes:de0a01f529
("PCI: xilinx-nwl: Enable the clock through CCF") Link: https://lore.kernel.org/r/20240531161337.864994-6-sean.anderson@linux.dev Signed-off-by: Sean Anderson <sean.anderson@linux.dev> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f1058b0780
commit
4f201a94ac
|
@ -790,6 +790,7 @@ static int nwl_pcie_probe(struct platform_device *pdev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
pcie = pci_host_bridge_priv(bridge);
|
pcie = pci_host_bridge_priv(bridge);
|
||||||
|
platform_set_drvdata(pdev, pcie);
|
||||||
|
|
||||||
pcie->dev = dev;
|
pcie->dev = dev;
|
||||||
pcie->ecam_value = NWL_ECAM_VALUE_DEFAULT;
|
pcie->ecam_value = NWL_ECAM_VALUE_DEFAULT;
|
||||||
|
@ -813,13 +814,13 @@ static int nwl_pcie_probe(struct platform_device *pdev)
|
||||||
err = nwl_pcie_bridge_init(pcie);
|
err = nwl_pcie_bridge_init(pcie);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev, "HW Initialization failed\n");
|
dev_err(dev, "HW Initialization failed\n");
|
||||||
return err;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = nwl_pcie_init_irq_domain(pcie);
|
err = nwl_pcie_init_irq_domain(pcie);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev, "Failed creating IRQ Domain\n");
|
dev_err(dev, "Failed creating IRQ Domain\n");
|
||||||
return err;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
bridge->sysdata = pcie;
|
bridge->sysdata = pcie;
|
||||||
|
@ -829,11 +830,24 @@ static int nwl_pcie_probe(struct platform_device *pdev)
|
||||||
err = nwl_pcie_enable_msi(pcie);
|
err = nwl_pcie_enable_msi(pcie);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(dev, "failed to enable MSI support: %d\n", err);
|
dev_err(dev, "failed to enable MSI support: %d\n", err);
|
||||||
return err;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pci_host_probe(bridge);
|
err = pci_host_probe(bridge);
|
||||||
|
if (!err)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_clk:
|
||||||
|
clk_disable_unprepare(pcie->clk);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void nwl_pcie_remove(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct nwl_pcie *pcie = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
clk_disable_unprepare(pcie->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver nwl_pcie_driver = {
|
static struct platform_driver nwl_pcie_driver = {
|
||||||
|
@ -843,5 +857,6 @@ static struct platform_driver nwl_pcie_driver = {
|
||||||
.of_match_table = nwl_pcie_of_match,
|
.of_match_table = nwl_pcie_of_match,
|
||||||
},
|
},
|
||||||
.probe = nwl_pcie_probe,
|
.probe = nwl_pcie_probe,
|
||||||
|
.remove_new = nwl_pcie_remove,
|
||||||
};
|
};
|
||||||
builtin_platform_driver(nwl_pcie_driver);
|
builtin_platform_driver(nwl_pcie_driver);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user