mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-27 23:20:26 +09:00
env: sf: add missing spi_flash_free
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>
This commit is contained in:
parent
25d90ad45a
commit
c2d00364c1
9
env/sf.c
vendored
9
env/sf.c
vendored
@ -154,6 +154,9 @@ static int env_sf_save(void)
|
|||||||
printf("Valid environment: %d\n", (int)gd->env_valid);
|
printf("Valid environment: %d\n", (int)gd->env_valid);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
spi_flash_free(env_flash);
|
||||||
|
env_flash = NULL;
|
||||||
|
|
||||||
if (saved_buffer)
|
if (saved_buffer)
|
||||||
free(saved_buffer);
|
free(saved_buffer);
|
||||||
|
|
||||||
@ -255,6 +258,9 @@ static int env_sf_save(void)
|
|||||||
puts("done\n");
|
puts("done\n");
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
spi_flash_free(env_flash);
|
||||||
|
env_flash = NULL;
|
||||||
|
|
||||||
if (saved_buffer)
|
if (saved_buffer)
|
||||||
free(saved_buffer);
|
free(saved_buffer);
|
||||||
|
|
||||||
@ -413,6 +419,9 @@ static int env_sf_init_early(void)
|
|||||||
gd->env_addr = (unsigned long)&tmp_env1->data;
|
gd->env_addr = (unsigned long)&tmp_env1->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spi_flash_free(env_flash);
|
||||||
|
env_flash = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err_read:
|
err_read:
|
||||||
spi_flash_free(env_flash);
|
spi_flash_free(env_flash);
|
||||||
|
Loading…
Reference in New Issue
Block a user