[PATCH] xilinx: Check return value from variable setup

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] xilinx: Check return value from variable setup

Michal Simek-3
env_set..() can failed that's why check return status and report it back to
make sure that user is aware that's something went wrong.

Signed-off-by: Michal Simek <[hidden email]>
---

 board/xilinx/common/board.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 0782d08ee3fe..0d6d0d29ac0f 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -78,15 +78,19 @@ void *board_fdt_blob_setup(void)
 int board_late_init_xilinx(void)
 {
  ulong initrd_hi;
+ int ret = 0;
 
- env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
+ ret |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
 
  initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
  initrd_hi = round_down(initrd_hi, SZ_16M);
- env_set_addr("initrd_high", (void *)initrd_hi);
+ ret |= env_set_addr("initrd_high", (void *)initrd_hi);
 
- env_set_addr("bootm_low", (void *)gd->ram_base);
- env_set_addr("bootm_size", (void *)gd->ram_size);
+ ret |= env_set_addr("bootm_low", (void *)gd->ram_base);
+ ret |= env_set_addr("bootm_size", (void *)gd->ram_size);
+
+ if (ret)
+ printf("%s: Saving run time variables FAILED\n", __func__);
 
  return 0;
 }
--
2.27.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] xilinx: Check return value from variable setup

Michal Simek-4
st 5. 8. 2020 v 14:03 odesílatel Michal Simek <[hidden email]> napsal:

>
> env_set..() can failed that's why check return status and report it back to
> make sure that user is aware that's something went wrong.
>
> Signed-off-by: Michal Simek <[hidden email]>
> ---
>
>  board/xilinx/common/board.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> index 0782d08ee3fe..0d6d0d29ac0f 100644
> --- a/board/xilinx/common/board.c
> +++ b/board/xilinx/common/board.c
> @@ -78,15 +78,19 @@ void *board_fdt_blob_setup(void)
>  int board_late_init_xilinx(void)
>  {
>         ulong initrd_hi;
> +       int ret = 0;
>
> -       env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
> +       ret |= env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET);
>
>         initrd_hi = gd->start_addr_sp - CONFIG_STACK_SIZE;
>         initrd_hi = round_down(initrd_hi, SZ_16M);
> -       env_set_addr("initrd_high", (void *)initrd_hi);
> +       ret |= env_set_addr("initrd_high", (void *)initrd_hi);
>
> -       env_set_addr("bootm_low", (void *)gd->ram_base);
> -       env_set_addr("bootm_size", (void *)gd->ram_size);
> +       ret |= env_set_addr("bootm_low", (void *)gd->ram_base);
> +       ret |= env_set_addr("bootm_size", (void *)gd->ram_size);
> +
> +       if (ret)
> +               printf("%s: Saving run time variables FAILED\n", __func__);
>
>         return 0;
>  }
> --
> 2.27.0
>

Please ignore this patch. I will change this to be align with the latest work.

Thanks,
Michal

--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs