diff mbox series

[2/3] spl: fit: fail fit loading in case of FDT appending error

Message ID 20200509115506.31746-3-dariobin@libero.it
State Superseded
Headers show
Series Fix the SPL loading of a FIT image from NAND | expand

Commit Message

Dario Binacchi May 9, 2020, 11:55 a.m. UTC
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.

Signed-off-by: Dario Binacchi <dariobin at libero.it>
---

 common/spl/spl_fit.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Stefan Roese May 9, 2020, 12:07 p.m. UTC | #1
On 09.05.20 13:55, Dario Binacchi wrote:
> 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.
> 
> Signed-off-by: Dario Binacchi <dariobin at libero.it>
> ---
> 
>   common/spl/spl_fit.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index c51e4beb1c..cc518383e8 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -617,9 +617,14 @@ 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 !CONFIG_IS_ENABLED(OF_EMBED)

Please use this instead of using #ifdef's:

		if (IS_ENABLED(CONFIG_OF_EMBED))

Thanks,
Stefan
diff mbox series

Patch

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index c51e4beb1c..cc518383e8 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -617,9 +617,14 @@  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 !CONFIG_IS_ENABLED(OF_EMBED)
+		if (ret < 0)
+			return ret;
+#endif
+	}
 
 	firmware_node = node;
 	/* Now check if there are more images for us to load */