From 9199e9cb082fff290cdac2d323458f17db2a9ad0 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 6 Jun 2018 08:07:27 +0200 Subject: bootm: Split bootm_load_devicetree into two functions It is not always desired to get the devicetree from image data and load it to a SDRAM region at the same time. Sometimes it's enough to just load it to an allocated address (in case the user has no constraints where the devicetree should be placed. This patch splits bootm_load_devicetree into bootm_get_devicetree which returns a pointer to the allocated devicetree and bootm_load_devicetree which loads the devicetree to a specified region. Signed-off-by: Sascha Hauer --- arch/arm/lib32/bootm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'arch/arm/lib32') diff --git a/arch/arm/lib32/bootm.c b/arch/arm/lib32/bootm.c index a28079564d..b1ac2df731 100644 --- a/arch/arm/lib32/bootm.c +++ b/arch/arm/lib32/bootm.c @@ -165,11 +165,18 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, free_mem = PAGE_ALIGN(initrd_end + 1); } + if (!fdt) { + fdt = bootm_get_devicetree(data); + if (IS_ERR(fdt)) + return PTR_ERR(fdt); + } + if (fdt) { - fdt_load_address = fdt; - } else { fdt_load_address = (void *)free_mem; - ret = bootm_load_devicetree(data, free_mem); + ret = bootm_load_devicetree(data, fdt, free_mem); + + free(fdt); + if (ret) return ret; } -- cgit v1.2.3