Message ID | 20210224115218.RFC.1.Ie56b2c6882d80bb19c6e899de5ddeca350a89d61@changeid |
---|---|
State | Accepted |
Commit | c2d00364c1d638eaa85d5f1384170f610b3c4beb |
Delegated to: | Tom Rini |
Headers | show |
Series | env: sf: remove the static env_flash variable | expand |
On Wed, Feb 24, 2021 at 11:52:35AM +0100, Patrick Delaunay wrote: > Free the SPI resources by calling spi_flash_free() in each env sf > function to avoid issue for other SPI users. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Applied to u-boot/master, thanks!
diff --git a/env/sf.c b/env/sf.c index 6b61a4b8de..acbd712aef 100644 --- a/env/sf.c +++ b/env/sf.c @@ -149,6 +149,9 @@ static int env_sf_save(void) printf("Valid environment: %d\n", (int)gd->env_valid); done: + spi_flash_free(env_flash); + env_flash = NULL; + if (saved_buffer) free(saved_buffer); @@ -246,6 +249,9 @@ static int env_sf_save(void) puts("done\n"); done: + spi_flash_free(env_flash); + env_flash = NULL; + if (saved_buffer) free(saved_buffer); @@ -404,6 +410,9 @@ static int env_sf_init_early(void) gd->env_addr = (unsigned long)&tmp_env1->data; } + spi_flash_free(env_flash); + env_flash = NULL; + return 0; err_read: spi_flash_free(env_flash);
Free the SPI resources by calling spi_flash_free() in each env sf function to avoid issue for other SPI users. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> --- env/sf.c | 9 +++++++++ 1 file changed, 9 insertions(+)