diff mbox series

[U-Boot,2/2] dm: pci: Avoid setting a PCI region that has 0 size

Message ID 1522136766-30991-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit ee1109bb45be4aaf057a44a70c9bdf2d7ff5bbc7
Delegated to: Bin Meng
Headers show
Series [U-Boot,1/2] dm: pci: Check board information pointer in decode_regions() | expand

Commit Message

Bin Meng March 27, 2018, 7:46 a.m. UTC
It makes no sense to set a PCI region that has 0 size.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/pci/pci-uclass.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Simon Glass March 29, 2018, 10:43 p.m. UTC | #1
On 27 March 2018 at 15:46, Bin Meng <bmeng.cn@gmail.com> wrote:
> It makes no sense to set a PCI region that has 0 size.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/pci/pci-uclass.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng March 30, 2018, 7:30 a.m. UTC | #2
On Fri, Mar 30, 2018 at 6:43 AM, Simon Glass <sjg@chromium.org> wrote:
> On 27 March 2018 at 15:46, Bin Meng <bmeng.cn@gmail.com> wrote:
>> It makes no sense to set a PCI region that has 0 size.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/pci/pci-uclass.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86, thanks!
diff mbox series

Patch

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 9d51236..a2e8296 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;