]> git.sur5r.net Git - u-boot/commitdiff
dm: pci: Avoid setting a PCI region that has 0 size
authorBin Meng <bmeng.cn@gmail.com>
Tue, 27 Mar 2018 07:46:06 +0000 (00:46 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 30 Mar 2018 08:05:08 +0000 (16:05 +0800)
It makes no sense to set a PCI region that has 0 size.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/pci/pci-uclass.c

index 9d51236770ff341848efe2b3f3c3828b07ef6c13..a2e829608a34f25c7d45673991a764ae523bc5ee 100644 (file)
@@ -897,8 +897,9 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node,
 #endif
        if (gd->pci_ram_top && gd->pci_ram_top < base + size)
                size = gd->pci_ram_top - base;
-       pci_set_region(hose->regions + hose->region_count++, base, base,
-                      size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
+       if (size)
+               pci_set_region(hose->regions + hose->region_count++, base,
+                       base, size, PCI_REGION_MEM | PCI_REGION_SYS_MEMORY);
 #endif
 
        return 0;