diff mbox

[U-Boot] boot_fit: Change return value from FDT_ERROR to -EINVAL in fdt_offset()

Message ID 20170804204702.6677-1-iwamatsu@nigauri.org
State Accepted
Commit 160cfc4b5a6f761d07ade25472ab1d8408100d1a
Delegated to: Tom Rini
Headers show

Commit Message

Nobuhiro Iwamatsu Aug. 4, 2017, 8:47 p.m. UTC
FDT_ERROR is defined as unsigned long. However, since the return value of
fdt_offset() is int, a warning will occur when compiling. Also, it is better
to use -EINVAL than FDT_ERROR.
This fixes this problem by change return value from FDT_ERROR to -EINVAL.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
CC: Franklin S Cooper Jr <fcooper@ti.com>
---
 common/boot_fit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Franklin S Cooper Jr Aug. 10, 2017, 2:08 a.m. UTC | #1
On 08/04/2017 03:47 PM, Nobuhiro Iwamatsu wrote:
> FDT_ERROR is defined as unsigned long. However, since the return value of
> fdt_offset() is int, a warning will occur when compiling. Also, it is better
> to use -EINVAL than FDT_ERROR.
> This fixes this problem by change return value from FDT_ERROR to -EINVAL.
> 
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> CC: Franklin S Cooper Jr <fcooper@ti.com>
> ---
>  common/boot_fit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/boot_fit.c b/common/boot_fit.c
> index 51440a6e6f..0a723150b5 100644
> --- a/common/boot_fit.c
> +++ b/common/boot_fit.c
> @@ -25,7 +25,7 @@ int fdt_offset(void *fit)
>  	images = fdt_path_offset(fit, FIT_IMAGES_PATH);
>  	if (images < 0) {
>  		debug("%s: Cannot find /images node: %d\n", __func__, images);
> -		return FDT_ERROR;
> +		return -EINVAL;
>  	}
>  

Reviewed-by: Franklin S Cooper Jr <fcooper@ti.com>
>  	fdt_name = fdt_getprop(fit, node, FIT_FDT_PROP, &fdt_len);
>
Tom Rini Aug. 14, 2017, 12:08 a.m. UTC | #2
On Sat, Aug 05, 2017 at 05:47:02AM +0900, Nobuhiro Iwamatsu wrote:

> FDT_ERROR is defined as unsigned long. However, since the return value of
> fdt_offset() is int, a warning will occur when compiling. Also, it is better
> to use -EINVAL than FDT_ERROR.
> This fixes this problem by change return value from FDT_ERROR to -EINVAL.
> 
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> CC: Franklin S Cooper Jr <fcooper@ti.com>
> Reviewed-by: Franklin S Cooper Jr <fcooper@ti.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/boot_fit.c b/common/boot_fit.c
index 51440a6e6f..0a723150b5 100644
--- a/common/boot_fit.c
+++ b/common/boot_fit.c
@@ -25,7 +25,7 @@  int fdt_offset(void *fit)
 	images = fdt_path_offset(fit, FIT_IMAGES_PATH);
 	if (images < 0) {
 		debug("%s: Cannot find /images node: %d\n", __func__, images);
-		return FDT_ERROR;
+		return -EINVAL;
 	}
 
 	fdt_name = fdt_getprop(fit, node, FIT_FDT_PROP, &fdt_len);