
Hi,
Pepperl+Fuchs GmbH, Mannheim Geschaeftsfuehrer/Managing Directors: Dr.-Ing. Gunther Kegel (Vors./CEO), Werner Guthier, Mehmet Hatiboglu Vorsitzender des Aufsichtsrats/Chairman of the supervisory board: Michael Fuchs sen. Registergericht/Register Court: AG Mannheim HRB 4713 On 10.07.2018 22:49, Simon Glass wrote:
Hi Nicholas,
On 10 July 2018 at 06:57, Nicholas Faustini nicholas.faustini@azcomtech.com wrote:
When called with ENVOP_SAVE, env_get_location() only returns the gd->env_load_location variable without actually checking for the environment location and priority. This allows saving the environment into the same location that has been previously loaded.
This behaviour causes env_save() to fall into an infinite loop when the low-level drv->save() call fails.
Why is this? Should it not stop eventually? Do we need a limit on prio?
See my description in this mail:
https://lists.denx.de/pipermail/u-boot/2018-April/324728.html
Unfortunately, I got diverted at that time and could not follow up on this. Essentially, the question is raised what 'env save' is supposed to do with multiple environments.
Currently, env_save() effectively stores only to the location where the env has been loaded from, which is questionable. But storing to all locations or the default location might not be correct, either.
Maybe the 'env save' command might need a parameter the tells it where to save?
Regards, Simon (Goldschmidt)
The env_save() function should not loop through the environment location list but it should use the previously discovered environment driver once.
What is that? It should be possible to write the env to multiple places. Also what is the previously discovered environment?
Signed-off-by: Nicholas Faustini nicholas.faustini@azcomtech.com
env/env.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/env/env.c b/env/env.c index 5c0842a..897d197 100644 --- a/env/env.c +++ b/env/env.c @@ -211,16 +211,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 -ENODEV; printf("Saving Environment to %s... ", drv->name); ret = drv->save();
-- 2.7.4
Regards, Simon
Wichtiger Hinweis: Diese E-Mail einschliesslich ihrer Anhaenge enthaelt vertrauliche und rechtlich geschuetzte Informationen, die nur fuer den Adressaten bestimmt sind. Sollten Sie nicht der bezeichnete Adressat sein, so teilen Sie dies bitte dem Absender umgehend mit und loeschen Sie diese Nachricht und ihre Anhaenge. Die unbefugte Weitergabe, das Anfertigen von Kopien und jede Veraenderung der E-Mail ist untersagt. Der Absender haftet nicht fuer Inhalte von veraenderten E-Mails.
Important Information: This e-mail message including its attachments contains confidential and legally protected information solely intended for the addressee. If you are not the intended addressee of this message, please contact the addresser immediately and delete this message including its attachments. The unauthorized dissemination, copying and change of this e-mail are strictly forbidden. The addresser shall not be liable for the content of such changed e-mails.