[PATCH 2/7] pci: fix copy-paste bug

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 16 23:38:46 PDT 2015


Test for the correct resource before derefencing it.

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 cb8c539..d6e95c3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -53,7 +53,7 @@ void register_pci_controller(struct pci_controller *hose)
 	else
 		last_mem = 0;
 
-	if (bus->resource[PCI_BUS_RESOURCE_MEM])
+	if (bus->resource[PCI_BUS_RESOURCE_MEM_PREF])
 		last_mem_pref = bus->resource[PCI_BUS_RESOURCE_MEM_PREF]->start;
 	else
 		last_mem_pref = 0;
-- 
2.1.4




More information about the barebox mailing list