summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2018-03-27 00:46:06 -0700
committerBin Meng <bmeng.cn@gmail.com>2018-03-30 16:05:08 +0800
commitee1109bb45be4aaf057a44a70c9bdf2d7ff5bbc7 (patch)
treee4b4be886e2eea7a4e9f8daed18aea3c37f05103 /drivers
parent1eaf7800b6b99b48e73eab56202cf1c7a0e19ac9 (diff)
dm: pci: Avoid setting a PCI region that has 0 size
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci-uclass.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 9d51236770..a2e829608a 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -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;