From ed5af03f9bb8905f1e94d68ab49f22d7f061d75f Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Thu, 15 Feb 2018 19:05:59 +0100 Subject: fdt: Fixup only valid memory banks 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 Signed-off-by: Thierry Reding --- common/fdt_support.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'common/fdt_support.c') diff --git a/common/fdt_support.c b/common/fdt_support.c index bd0478de40c..b14853625f6 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -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; -- cgit v1.2.3