提交 5d18d702 编写于 作者: P Pali Rohár 提交者: Lorenzo Pieralisi

PCI: mvebu: Check for errors from pci_bridge_emul_init() call

Function pci_bridge_emul_init() may fail so correctly check for errors.

Link: https://lore.kernel.org/r/20211125124605.25915-3-pali@kernel.org
Fixes: 1f08673e ("PCI: mvebu: Convert to PCI emulated bridge config space")
Signed-off-by: NPali Rohár <pali@kernel.org>
Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
上级 8cdabfdd
...@@ -570,7 +570,7 @@ static struct pci_bridge_emul_ops mvebu_pci_bridge_emul_ops = { ...@@ -570,7 +570,7 @@ static struct pci_bridge_emul_ops mvebu_pci_bridge_emul_ops = {
* Initialize the configuration space of the PCI-to-PCI bridge * Initialize the configuration space of the PCI-to-PCI bridge
* associated with the given PCIe interface. * associated with the given PCIe interface.
*/ */
static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) static int mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port)
{ {
struct pci_bridge_emul *bridge = &port->bridge; struct pci_bridge_emul *bridge = &port->bridge;
...@@ -589,7 +589,7 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port) ...@@ -589,7 +589,7 @@ static void mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port)
bridge->data = port; bridge->data = port;
bridge->ops = &mvebu_pci_bridge_emul_ops; bridge->ops = &mvebu_pci_bridge_emul_ops;
pci_bridge_emul_init(bridge, PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR); return pci_bridge_emul_init(bridge, PCI_BRIDGE_EMUL_NO_PREFETCHABLE_BAR);
} }
static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys) static inline struct mvebu_pcie *sys_to_pcie(struct pci_sys_data *sys)
...@@ -1075,9 +1075,18 @@ static int mvebu_pcie_probe(struct platform_device *pdev) ...@@ -1075,9 +1075,18 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
continue; continue;
} }
ret = mvebu_pci_bridge_emul_init(port);
if (ret < 0) {
dev_err(dev, "%s: cannot init emulated bridge\n",
port->name);
devm_iounmap(dev, port->base);
port->base = NULL;
mvebu_pcie_powerdown(port);
continue;
}
mvebu_pcie_setup_hw(port); mvebu_pcie_setup_hw(port);
mvebu_pcie_set_local_dev_nr(port, 1); mvebu_pcie_set_local_dev_nr(port, 1);
mvebu_pci_bridge_emul_init(port);
} }
pcie->nports = i; pcie->nports = i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册