]> git.ipfire.org Git - u-boot.git/commitdiff
fdt: Fixup only valid memory banks
authorThierry Reding <treding@nvidia.com>
Thu, 15 Feb 2018 18:05:59 +0000 (19:05 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 23 Feb 2018 15:40:50 +0000 (10:40 -0500)
Memory banks with address 0 and size 0 are empty and should not be
passed to the OS via device tree.

Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
common/fdt_support.c

index bd0478de40c812c3f08a43af8f33866f21e12927..b14853625f62cc89ce29b763c66a5bfd76d45437 100644 (file)
@@ -447,6 +447,13 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
                return err;
        }
 
+       for (i = 0; i < banks; i++) {
+               if (start[i] == 0 && size[i] == 0)
+                       break;
+       }
+
+       banks = i;
+
        if (!banks)
                return 0;