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>
if (prio >= ARRAY_SIZE(env_locations))
return ENVL_UNKNOWN;
- gd->env_load_prio = prio;
-
return env_locations[prio];
}
ret = drv->load();
if (!ret) {
printf("OK\n");
+ gd->env_load_prio = prio;
+
return 0;
} else if (ret == -ENOMSG) {
/* Handle "bad CRC" case */
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;
}