Skip to content

Commit 7862a61

Browse files
paliLorenzo Pieralisi
authored andcommitted
PCI: aardvark: 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/[email protected] Fixes: 8a3ebd8 ("PCI: aardvark: Implement emulated root PCI bridge config space") Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Marek Behún <[email protected]>
1 parent b32c012 commit 7862a61

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/pci/controller/pci-aardvark.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = {
607607
* Initialize the configuration space of the PCI-to-PCI bridge
608608
* associated with the given PCIe interface.
609609
*/
610-
static void advk_sw_pci_bridge_init(struct advk_pcie *pcie)
610+
static int advk_sw_pci_bridge_init(struct advk_pcie *pcie)
611611
{
612612
struct pci_bridge_emul *bridge = &pcie->bridge;
613613

@@ -633,8 +633,7 @@ static void advk_sw_pci_bridge_init(struct advk_pcie *pcie)
633633
bridge->data = pcie;
634634
bridge->ops = &advk_pci_bridge_emul_ops;
635635

636-
pci_bridge_emul_init(bridge, 0);
637-
636+
return pci_bridge_emul_init(bridge, 0);
638637
}
639638

640639
static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,
@@ -1167,7 +1166,11 @@ static int advk_pcie_probe(struct platform_device *pdev)
11671166

11681167
advk_pcie_setup_hw(pcie);
11691168

1170-
advk_sw_pci_bridge_init(pcie);
1169+
ret = advk_sw_pci_bridge_init(pcie);
1170+
if (ret) {
1171+
dev_err(dev, "Failed to register emulated root PCI bridge\n");
1172+
return ret;
1173+
}
11711174

11721175
ret = advk_pcie_init_irq_domain(pcie);
11731176
if (ret) {

0 commit comments

Comments
 (0)