diff options
author | Ye Li <ye.li@nxp.com> | 2018-06-01 00:58:03 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-06-01 01:02:19 -0700 |
commit | a396e04c1180e85c618aaa4be099381de8b15199 (patch) | |
tree | 0db3de4c87685a61d42807b6ba3fa9d83b7db44f /env | |
parent | ba99b856ac290c298c9be5ef6f6f6229b1d9f539 (diff) |
MLK-18478 env: Fix dead loop when env save failed
When env save is failed, 2018 u-boot will loop infinitely to save the env,
and each time returns failure. The root cause is env_driver_lookup only returns
current env location for ENVOP_SAVE, no matter what the prio is. So the loop
can't exit until the save is successful.
Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'env')
-rw-r--r-- | env/env.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -191,16 +191,16 @@ int env_load(void) int env_save(void) { struct env_driver *drv; - int prio; - for (prio = 0; (drv = env_driver_lookup(ENVOP_SAVE, prio)); prio++) { + drv = env_driver_lookup(ENVOP_SAVE, 0); + if (drv) { int ret; if (!drv->save) - continue; + return -ENODEV; if (!env_has_inited(drv->location)) - continue; + return -EPERM; printf("Saving Environment to %s... ", drv->name); ret = drv->save(); |