From: Quentin Schulz Date: Wed, 17 Jan 2024 17:59:12 +0000 (+0100) Subject: env: migrate env_get_default to call env_get_default_into X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=87d3c472a266261642ad26a3d4b040de09edac71;p=u-boot.git env: migrate env_get_default to call env_get_default_into 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 Reviewed-by: Tom Rini Reviewed-by: Kever Yang Signed-off-by: Quentin Schulz --- diff --git a/env/common.c b/env/common.c index ebcb10854d..beebbd163b 100644 --- a/env/common.c +++ b/env/common.c @@ -351,9 +351,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;