env: sf: Don't call spi_flash_free when CONFIG_DM_SPI_FLASH=y
PATCH 1/1 env: sf: Don't call spi_flash_free when CONFIG_DM_SPI_FLASH=y
As cmd/sf.c shows we don't want to call spi_free_flash() if CONFIG_DM_SPI_FLASH is true.
This fixes a bug where ENV_IN_SPI_FLASH is true and partitions are allocated on a DM_SPI_FLASH. The environment will load from SPI flash and the dm device will appear in "dm tree" but, no MTD devices will be found because spi_free_flash() will have removed the MTD device from mtd_idr.
Fix this case by avoiding the spi_free_flash() call when DM_SPI_FLASH is true as we already do in cmd/sf.c.
Signed-off-by Bryan O'Donoghue <[email protected]>
--- env/sf.c | 2 ++ 1 file changed, 2 insertions(+)
env/sf.c +2 -0
@@ -178,7 +178,9 @@ static int env_sf_load(void) ret =env_import_redund ((char *)tmp_env1, read1_fail, (char *)tmp_env2, read2_fail); +#ifndef CONFIG_DM_SPI_FLASH spi_flash_free (env_flash); +#endif env_flash =NULL ; out:free (tmp_env1);
Signature · 1 line
2.24.0