mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-18 14:48:17 +01:00
mtd: Fix get_mtdparts()
When ENV_IS_IN_UBI is enable, get_mtdparts is called before relocation. During first get_mtdparts() call, mtdparts is not available in environment, it can be retrieved by calling board_mtdparts_default(), but following env_set() do nothing as we are before relocation. Finally mtdparts is still not available in environment. At second get_mtdparts() call, use_defaults is false, but mtdparts is still not in environment and is NULL. Remove use_defaults bool, only mtdparts criteria is useful. Fixes: commit 5ffcd50612f6 ("mtd: Use default mtdparts/mtids when not defined in the environment") Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
This commit is contained in:
parent
8f24b1a4a9
commit
e6b7afe737
@ -122,7 +122,6 @@ static const char *get_mtdparts(void)
|
|||||||
{
|
{
|
||||||
__maybe_unused const char *mtdids = NULL;
|
__maybe_unused const char *mtdids = NULL;
|
||||||
static char tmp_parts[MTDPARTS_MAXLEN];
|
static char tmp_parts[MTDPARTS_MAXLEN];
|
||||||
static bool use_defaults = true;
|
|
||||||
const char *mtdparts = NULL;
|
const char *mtdparts = NULL;
|
||||||
|
|
||||||
if (gd->flags & GD_FLG_ENV_READY)
|
if (gd->flags & GD_FLG_ENV_READY)
|
||||||
@ -130,7 +129,7 @@ static const char *get_mtdparts(void)
|
|||||||
else if (env_get_f("mtdparts", tmp_parts, sizeof(tmp_parts)) != -1)
|
else if (env_get_f("mtdparts", tmp_parts, sizeof(tmp_parts)) != -1)
|
||||||
mtdparts = tmp_parts;
|
mtdparts = tmp_parts;
|
||||||
|
|
||||||
if (mtdparts || !use_defaults)
|
if (mtdparts)
|
||||||
return mtdparts;
|
return mtdparts;
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
|
#if defined(CONFIG_SYS_MTDPARTS_RUNTIME)
|
||||||
@ -144,8 +143,6 @@ static const char *get_mtdparts(void)
|
|||||||
if (mtdparts)
|
if (mtdparts)
|
||||||
env_set("mtdparts", mtdparts);
|
env_set("mtdparts", mtdparts);
|
||||||
|
|
||||||
use_defaults = false;
|
|
||||||
|
|
||||||
return mtdparts;
|
return mtdparts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user