Jelajahi Sumber

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>
Bin Meng 7 tahun lalu
induk
melakukan
ee1109bb45
1 mengubah file dengan 3 tambahan dan 2 penghapusan
  1. 3 2
      drivers/pci/pci-uclass.c

+ 3 - 2
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;