From: Ye Li Date: Tue, 31 Jan 2023 06:41:58 +0000 (+0800) Subject: env: mmc: Fix offset issue for env save X-Git-Tag: v2025.01-rc5-pxa1908~1118^2~1 X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=ccd0542ab2607228c8e434e2875b014f9bba49f8;p=u-boot.git env: mmc: Fix offset issue for env save Fix the issue in commit 46c9016 ("env: mcc: Drop unnecessary #ifdefs") If CONFIG_SYS_REDUNDAND_ENVIRONMENT is not defined, the offset value becomes undetermined, so write env to unexpected offset. Signed-off-by: Ye Li Reviewed-by: Jaehoon Chung --- diff --git a/env/mmc.c b/env/mmc.c index 85761417f2..5b01f657a7 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -273,11 +273,11 @@ static int env_mmc_save(void) if (ret) goto fini; } + } - if (mmc_get_env_addr(mmc, copy, &offset)) { - ret = 1; - goto fini; - } + if (mmc_get_env_addr(mmc, copy, &offset)) { + ret = 1; + goto fini; } printf("Writing to %sMMC(%d)... ", copy ? "redundant " : "", dev);