diff options
Diffstat (limited to 'env')
-rw-r--r-- | env/nand.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/env/nand.c b/env/nand.c index d4d03a4fc98..a080e36013d 100644 --- a/env/nand.c +++ b/env/nand.c @@ -159,7 +159,7 @@ static int writeenv(size_t offset, u_char *buf) struct nand_env_location { const char *name; - const nand_erase_options_t erase_opts; + nand_erase_options_t erase_opts; }; static int erase_and_write_env(const struct nand_env_location *location, @@ -188,25 +188,17 @@ static int env_nand_save(void) int ret = 0; ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1); int env_idx = 0; - static const struct nand_env_location location[] = { - { - .name = "NAND", - .erase_opts = { - .length = CONFIG_ENV_RANGE, - .offset = env_get_offset(CONFIG_ENV_OFFSET), - }, - }, + static struct nand_env_location location[2] = {0}; + + location[0].name = "NAND"; + location[0].erase_opts.length = CONFIG_ENV_RANGE; + location[0].erase_opts.offset = env_get_offset(CONFIG_ENV_OFFSET); + #ifdef CONFIG_ENV_OFFSET_REDUND - { - .name = "redundant NAND", - .erase_opts = { - .length = CONFIG_ENV_RANGE, - .offset = CONFIG_ENV_OFFSET_REDUND, - }, - }, + location[1].name = "redundant NAND"; + location[1].erase_opts.length = CONFIG_ENV_RANGE; + location[1].erase_opts.offset = CONFIG_ENV_OFFSET_REDUND; #endif - }; - if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE) return 1; |