]> git.baikalelectronics.ru Git - uboot.git/commitdiff
env: mmc: Fix offset issue for env save
authorYe Li <ye.li@nxp.com>
Tue, 31 Jan 2023 06:41:58 +0000 (14:41 +0800)
committerTom Rini <trini@konsulko.com>
Mon, 6 Feb 2023 22:10:15 +0000 (17:10 -0500)
Fix the issue in commit 591dbad ("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 <ye.li@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
env/mmc.c

index 85761417f2836ca57b3e9516c892c69ab1c54661..5b01f657a7a14a76cf206ec3309f49aa830c5775 100644 (file)
--- 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);