Question about env_flash variable in env/sf.c
Patrick DELAUNAY
patrick.delaunay at foss.st.com
Thu Dec 17 18:33:28 CET 2020
Hi,
I am reading the code in env/sf.c file (to add the .erase opt
and support of "env erase" command), and I have a question about
the static variable env_flash.
Today it is a global flash pointer, initialized by the function
setup_flash_device()
And it is called in all the functions before to use the SPI API
1/ env_sf_save()
2/ env_sf_load()
But this SPI resource is only released in env_sf_load() by:
spi_flash_free(env_flash);
env_flash = NULL;
I don't see any reason why it is not done also in env_sf_save(), after a
"env save".
But perhaps I miss something...
I ask because if it is the case the variable env_flash could be local at
each env_sf function, as result of setup_flash_device.
Any idea ?
Regards
Patrick
More information about the U-Boot
mailing list