From patchwork Mon May 11 06:43:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 245533 List-Id: U-Boot discussion From: dariobin at libero.it (Dario Binacchi) Date: Mon, 11 May 2020 08:43:16 +0200 Subject: [PATCH v2 2/3] spl: fit: fail fit loading in case of FDT appending error In-Reply-To: <20200511064317.20562-1-dariobin@libero.it> References: <20200511064317.20562-1-dariobin@libero.it> Message-ID: <20200511064317.20562-3-dariobin@libero.it> If uboot does not embed its device tree and the FIT loading function returns error in case of failure in the FDT append, the redundant itb image could be loaded. cc: Michael Trimarchi Signed-off-by: Dario Binacchi Reviewed-by: Michael Trimarchi --- Changes in v2: - Replace CONFIG_IS_ENABLED(OF_EMBED) with IS_ENABLED(CONFIG_OF_EMBED)) common/spl/spl_fit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index c51e4beb1c..42c354c908 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -617,9 +617,12 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, * Booting a next-stage U-Boot may require us to append the FDT. * We allow this to fail, as the U-Boot image might embed its FDT. */ - if (spl_image->os == IH_OS_U_BOOT) - spl_fit_append_fdt(spl_image, info, sector, fit, - images, base_offset); + if (spl_image->os == IH_OS_U_BOOT) { + ret = spl_fit_append_fdt(spl_image, info, sector, fit, + images, base_offset); + if (!IS_ENABLED(CONFIG_OF_EMBED) && ret < 0) + return ret; + } firmware_node = node; /* Now check if there are more images for us to load */