[PATCH 2/6] env: migrate env_get_default to call env_get_default_into

Kever Yang kever.yang at rock-chips.com
Thu Nov 9 04:33:39 CET 2023


On 2023/11/8 22:20, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
>
> Since both functions share a similar goal and env_get_default_into can
> do what env_get_default wants to do with specific arguments, let's make
> env_get_default call env_get_default_into so as to avoid code
> duplication.
>
> Cc: Quentin Schulz <foss+uboot at 0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
Reviewed-by: Kever Yang <kever.yang at rock-chips.com>

Thanks,
- Kever
> ---
>   env/common.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/env/common.c b/env/common.c
> index 307003099dd..930bdef2f58 100644
> --- a/env/common.c
> +++ b/env/common.c
> @@ -246,9 +246,11 @@ bool env_get_autostart(void)
>    */
>   char *env_get_default(const char *name)
>   {
> -	if (env_get_from_linear(default_environment, name,
> -				(char *)(gd->env_buf),
> -				sizeof(gd->env_buf)) >= 0)
> +	int ret;
> +
> +	ret = env_get_default_into(name, (char *)(gd->env_buf),
> +				   sizeof(gd->env_buf));
> +	if (ret >= 0)
>   		return (char *)(gd->env_buf);
>   
>   	return NULL;
>


More information about the U-Boot mailing list