mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
cmd: mtdparts: fix mtdparts variable presence confusion in mtdparts_init
A private buffer is used to read mtdparts variable from non-relocated environment. A pointer to that buffer is returned unconditionally, confusing later test for variable presence in the environment. Fix it by returning NULL when getenv_f fails. Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
This commit is contained in:
parent
52486927e7
commit
c0ac333947
1 changed files with 6 additions and 4 deletions
|
@ -1720,11 +1720,13 @@ int mtdparts_init(void)
|
|||
* before the env is relocated, then we need to use our own stack
|
||||
* buffer. gd->env_buf will be too small.
|
||||
*/
|
||||
if (gd->flags & GD_FLG_ENV_READY) {
|
||||
if (gd->flags & GD_FLG_ENV_READY)
|
||||
parts = getenv("mtdparts");
|
||||
} else {
|
||||
parts = tmp_parts;
|
||||
getenv_f("mtdparts", tmp_parts, MTDPARTS_MAXLEN);
|
||||
else {
|
||||
if (getenv_f("mtdparts", tmp_parts, MTDPARTS_MAXLEN) != -1)
|
||||
parts = tmp_parts;
|
||||
else
|
||||
parts = NULL;
|
||||
}
|
||||
current_partition = getenv("partition");
|
||||
|
||||
|
|
Loading…
Reference in a new issue