reorder checks in fsl_pcie_addr_valid(). Check first
stuff, we also can check when we use driver for PCI devices.

Signed-off-by: Heiko Schocher <h...@denx.de>
---

 drivers/pci/pcie_fsl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c
index ada6e12e2f..05b2522dac 100644
--- a/drivers/pci/pcie_fsl.c
+++ b/drivers/pci/pcie_fsl.c
@@ -30,13 +30,13 @@ static int fsl_pcie_addr_valid(struct fsl_pcie *pcie, 
pci_dev_t bdf)
        if (PCI_BUS(bdf) < bus->seq)
                return -EINVAL;
 
-       if (PCI_BUS(bdf) > bus->seq && (!fsl_pcie_link_up(pcie) || pcie->mode))
+       if (PCI_BUS(bdf) == (bus->seq + 1) && (PCI_DEV(bdf) > 0))
                return -EINVAL;
 
-       if (PCI_BUS(bdf) == bus->seq && (PCI_DEV(bdf) > 0 || PCI_FUNC(bdf) > 0))
+       if (PCI_BUS(bdf) > bus->seq && (!fsl_pcie_link_up(pcie) || pcie->mode))
                return -EINVAL;
 
-       if (PCI_BUS(bdf) == (bus->seq + 1) && (PCI_DEV(bdf) > 0))
+       if (PCI_BUS(bdf) == bus->seq && (PCI_DEV(bdf) > 0 || PCI_FUNC(bdf) > 0))
                return -EINVAL;
 
        return 0;
-- 
2.21.0

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to