summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2019-07-17 23:14:59 -0700
committerYe Li <ye.li@nxp.com>2019-07-17 23:29:29 -0700
commitda33243320c9ebbde3f343aee7623028a440a024 (patch)
treef413760f176fc410f30df8e0ec0dbc174eab1a85 /env
parent43ab220203f0847fd6c87430ab9dfd2997a780b9 (diff)
MLK-22283 env: fix NAND ENV build issue introduced by env offset change
Get below build error in nand env, because we should not call function in array initialization. env/nand.c: In function ‘env_nand_save’: env/nand.c:196:15: error: initializer element is not constant .offset = env_get_offset(CONFIG_ENV_OFFSET), Signed-off-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'env')
-rw-r--r--env/nand.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/env/nand.c b/env/nand.c
index d4d03a4fc9..a080e36013 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;