diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-07-28 11:51:17 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-07-31 10:13:00 -0400 |
commit | 6d8d8400a2bee44e0efbd7dbcfa33965560370d6 (patch) | |
tree | f300410fb1b42df628e7ccb51885ade1953f3b32 | |
parent | 22140d16e56cec3c2ea17a0abaf3d061ccbee039 (diff) | |
download | u-boot-6d8d8400a2bee44e0efbd7dbcfa33965560370d6.tar.gz |
env: correctly handle env_load_prio
Only update gd->env_load_prio in generic function env_load()
and no more in the weak function env_get_location() which is
called in many place (for example in env_driver_lookup, even
for ENVOP_SAVE operation).
This patch is a preliminary step to use env_driver_lookup()/
env_get_location() in new function env_select() without
updating gd->env_load_prio.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
-rw-r--r-- | env/env.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -131,8 +131,6 @@ __weak enum env_location env_get_location(enum env_operation op, int prio) if (prio >= ARRAY_SIZE(env_locations)) return ENVL_UNKNOWN; - gd->env_load_prio = prio; - return env_locations[prio]; } @@ -204,6 +202,8 @@ int env_load(void) ret = drv->load(); if (!ret) { printf("OK\n"); + gd->env_load_prio = prio; + return 0; } else if (ret == -ENOMSG) { /* Handle "bad CRC" case */ @@ -227,7 +227,8 @@ int env_load(void) debug("Selecting environment with bad CRC\n"); else best_prio = 0; - env_get_location(ENVOP_LOAD, best_prio); + + gd->env_load_prio = best_prio; return -ENODEV; } |