drivers: pci: Fix crash in rt-linux because of an uninitialized lock.
authorKevin.xie <kevin.xie@starfivetech.com>
Tue, 21 Feb 2023 03:18:51 +0000 (11:18 +0800)
committerKevin.xie <kevin.xie@starfivetech.com>
Tue, 21 Feb 2023 03:26:09 +0000 (11:26 +0800)
Adjust the order of invocations in probe to avoid from the crash.

Signed-off-by: Kevin.xie <kevin.xie@starfivetech.com>
drivers/pci/controller/pcie-plda.c

index 8fb1cb6..4013856 100644 (file)
@@ -983,12 +983,6 @@ static int plda_pcie_probe(struct platform_device *pdev)
        if (plda_pcie_is_link_up(pcie) == PLDA_LINK_DOWN)
                goto release;
 
-       ret = pci_host_probe(bridge);
-       if (ret < 0) {
-               dev_err(&pdev->dev, "Failed to pci host probe: %d\n", ret);
-               goto release;
-       }
-
        if (IS_ENABLED(CONFIG_PCI_MSI)) {
                ret = plda_pcie_enable_msi(pcie, bus);
                if (ret < 0) {
@@ -997,6 +991,12 @@ static int plda_pcie_probe(struct platform_device *pdev)
                }
        }
 
+       ret = pci_host_probe(bridge);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to pci host probe: %d\n", ret);
+               goto release;
+       }
+
 exit:
        return ret;