From: Marek Vasut <[email protected]>

In case the "dma-ranges" DT property contains either too many ranges
or the range start address is unaligned in such a way that populating
the range into the controller requires multiple entries, a situation
may occur where all ranges cannot be loaded into the controller.

Currently, the driver refuses to probe in such a situation. Relax this
behavior, load as many ranges as possible and warn if some ranges do
not fit anymore.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Lorenzo Pieralisi <[email protected]>
Cc: Wolfram Sang <[email protected]>
Cc: [email protected]
To: [email protected]
---
 drivers/pci/controller/pcie-rcar.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar.c 
b/drivers/pci/controller/pcie-rcar.c
index f6a669a9af41..938adff4148f 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -1069,8 +1069,9 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie 
*pcie,
                idx += 2;
 
                if (idx > MAX_NR_INBOUND_MAPS) {
-                       dev_err(pcie->dev, "Failed to map inbound regions!\n");
-                       return -EINVAL;
+                       dev_warn(pcie->dev,
+                                "Too many inbound regions, not all are 
mapped.\n");
+                       break;
                }
        }
        *index = idx;
-- 
2.20.1

Reply via email to