[PATCH 2/3] keymile: common: Fix pram variable radix
Stefan Roese
sr at denx.de
Tue Jan 19 16:13:29 CET 2021
Hi Niel,
On 08.01.21 11:53, Niel Fourie wrote:
> In set_km_env() the pram variable was set to an hexadecimal value,
> while initr_mem() expects an unsigned decimal. Set the pram variable
> to an unsigned decimal instead.
>
> Signed-off-by: Niel Fourie <lusus at denx.de>
> Cc: Holger Brunck <holger.brunck at hitachi-powergrids.com>
> Cc: Heiko Schocher <hs at denx.de>
> Cc: Priyanka Jain <priyanka.jain at nxp.com>
> ---
> board/keymile/common/common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
> index 03c7ce9da7..106787efd5 100644
> --- a/board/keymile/common/common.c
> +++ b/board/keymile/common/common.c
> @@ -60,7 +60,7 @@ int set_km_env(void)
> strict_strtoul(p, 16, &rootfssize);
> pram = (rootfssize + CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM +
> CONFIG_KM_PNVRAM) / 0x400;
> - sprintf((char *)buf, "0x%x", pram);
> + sprintf((char *)buf, "%u", pram);
> env_set("pram", (char *)buf);
Why don't you switch to using a different env_set_foo() API instead?
Like env_set_ulong() in this case? Or env_set_hex() in the HEX case.
This could also be done for some other env_set cases in this file as
well to reduce code size and complexity.
More information about the U-Boot
mailing list