Though it might be expected to do so, mmc_switch_part() does not change the part_num field of the device on which the partition has been changed. As such, checking to see whether the partition is already the target partition will fail to correctly restore the original configuration in cases like env_mmc which rely on this behavior to avoid having to preserve the pre-switch partition number outside the device structure.
Signed-off-by: Peter A. Bigot <p...@pabigot.com> --- common/env_mmc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/common/env_mmc.c b/common/env_mmc.c index a7621a8..9556296 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -78,11 +78,9 @@ static int mmc_set_env_part(struct mmc *mmc) dev = 0; #endif - if (part != mmc->part_num) { - ret = mmc_switch_part(dev, part); - if (ret) - puts("MMC partition switch failed\n"); - } + ret = mmc_switch_part(dev, part); + if (ret) + puts("MMC partition switch failed\n"); return ret; } @@ -113,8 +111,7 @@ static void fini_mmc_for_env(struct mmc *mmc) #ifdef CONFIG_SPL_BUILD dev = 0; #endif - if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num) - mmc_switch_part(dev, mmc->part_num); + mmc_switch_part(dev, mmc->part_num); #endif } -- 1.8.5.5 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot