diff mbox

[U-Boot] image: Fix expected return value

Message ID 20160916123455.27700-1-mario.six@gdsys.cc
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Mario Six Sept. 16, 2016, 12:34 p.m. UTC
Commit bac17b7 ("image-fit: switch ENOLINK to ENOENT") changed the
return value of fit_get_node_from_config from ENOLINK to ENOENT.

This causes a problem in boot_get_ramdisk, which treats the return value
-ENOLINK differently from other errors (namely, it does not signal a
failure if -ENOLINK is returned). As a result, booting a FIT image on
the Armada platform (and possibly others) fails with a "Ramdisk image is
corrupt or invalid" message, rendering FIT images unusable.

This patch fixes the error by changing the "special" return value in
boot_get_ramdisk from -ENOLINK to -ENOENT, so that the original behavior
is restored.

Reviewed-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 common/image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Sept. 19, 2016, 12:59 a.m. UTC | #1
On 16 September 2016 at 06:34, Mario Six <mario.six@gdsys.cc> wrote:
> Commit bac17b7 ("image-fit: switch ENOLINK to ENOENT") changed the
> return value of fit_get_node_from_config from ENOLINK to ENOENT.
>
> This causes a problem in boot_get_ramdisk, which treats the return value
> -ENOLINK differently from other errors (namely, it does not signal a
> failure if -ENOLINK is returned). As a result, booting a FIT image on
> the Armada platform (and possibly others) fails with a "Ramdisk image is
> corrupt or invalid" message, rendering FIT images unusable.
>
> This patch fixes the error by changing the "special" return value in
> boot_get_ramdisk from -ENOLINK to -ENOENT, so that the original behavior
> is restored.
>
> Reviewed-by: Jonathan Gray <jsg@jsg.id.au>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>
> ---
>  common/image.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/common/image.c b/common/image.c
index 7ad04ca..c8d9bc8 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1078,7 +1078,7 @@  int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
 			rd_addr = map_to_sysmem(images->fit_hdr_os);
 			rd_noffset = fit_get_node_from_config(images,
 					FIT_RAMDISK_PROP, rd_addr);
-			if (rd_noffset == -ENOLINK)
+			if (rd_noffset == -ENOENT)
 				return 0;
 			else if (rd_noffset < 0)
 				return 1;