[PATCH 3/3] pci: ignore BAR when it doesn't fit into bus resource

Sascha Hauer s.hauer at pengutronix.de
Wed Apr 3 01:07:03 PDT 2024


It can happen that a BAR doesn't fit into the bus resource. In this case
just ignore the BAR instead of failing the device. This is what Linux
does as well.
This helps me on the Protonic MECSBC where a NVME drive offers a 1GiB
BAR which doesn't seem to be needed to make the driver work.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index bc083270d9..e6370b5c7f 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -406,7 +406,7 @@ static void setup_device(struct pci_dev *dev, int max_bar)
 
 			if (ALIGN(*last_addr, size) + size > busres->end) {
 				pr_debug("BAR does not fit within bus %s res\n", kind);
-				return;
+				continue;
 			}
 
 			*last_addr = ALIGN(*last_addr, size);
-- 
2.39.2




More information about the barebox mailing list