]> git.sur5r.net Git - u-boot/commitdiff
dm: pci: Check board information pointer in decode_regions()
authorBin Meng <bmeng.cn@gmail.com>
Tue, 27 Mar 2018 07:46:05 +0000 (00:46 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 30 Mar 2018 08:05:08 +0000 (16:05 +0800)
PCI enumeration may happen very early on an x86 board. The board
information pointer should have been checked in decode_regions()
as its space may not be allocated yet.

With this commit, Intel Galileo board boots again.

Fixes: 664758c ("pci: Fix decode regions for memory banks")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/pci/pci-uclass.c

index ad43e8a27cc12404a0b198ece82e0dd8760ea75b..9d51236770ff341848efe2b3f3c3828b07ef6c13 100644 (file)
@@ -876,6 +876,9 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 #ifdef CONFIG_NR_DRAM_BANKS
        bd_t *bd = gd->bd;
 
+       if (!bd)
+               return 0;
+
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
                if (bd->bi_dram[i].size) {
                        pci_set_region(hose->regions + hose->region_count++,