We pass an address to the TF-A even when there is none. The FDT could be
absent when either CONFIG_ARCH_ROCKCHIP_ATF_PASS_FDT is disabled or
copying it to the scratch area fails. Instead of passing an invalid FDT
in this case, explicitly pass a NULL pointer.

Signed-off-by: Sascha Hauer <[email protected]>
---
 arch/arm/mach-rockchip/atf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index 74b8cdc2f4..0b4566f8ae 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -271,6 +271,8 @@ void __noreturn rk3588_barebox_entry(void *fdt)
        rk_scratch = (void *)arm_mem_scratch(memend);
 
        if (current_el() == 3) {
+               void *fdt_bl31 = NULL;
+
                rk3588_lowlevel_init();
                rockchip_store_bootrom_iram(IOMEM(RK3588_IRAM_BASE));
                ROCKCHIP_GET_ADDRESSES(RK3588, rk3588_bl31_bin, 
rk3588_bl32_bin);
@@ -281,9 +283,11 @@ void __noreturn rk3588_barebox_entry(void *fdt)
                        ret = rockchip_create_optee_fdt(rk_scratch->fdt, 
sizeof(rk_scratch->fdt));
                        if (ret)
                                pr_warn("Failed to create OP-TEE Device 
tree\n");
+                       else
+                               fdt_bl31 = rk_scratch->fdt;
                }
 
-               rockchip_atf_load_bl31(rk_scratch->fdt);
+               rockchip_atf_load_bl31(fdt_bl31);
                /* not reached when CONFIG_ARCH_ROCKCHIP_ATF */
        }
 
-- 
2.47.3


Reply via email to