From: Marek Vasut Date: Sun, 20 Aug 2017 17:07:39 +0200 Subject: [U-Boot] [PATCHv2] env: Correct case of no sub-init function In-Reply-To: <1503239271-1278-1-git-send-email-trini@konsulko.com> References: <1503196077-19276-1-git-send-email-trini@konsulko.com> <1503239271-1278-1-git-send-email-trini@konsulko.com> Message-ID: <10c902a1-ce08-dd78-6e79-285f6aa45795@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/20/2017 04:27 PM, Tom Rini wrote: > With the change to the environment code to remove the common init stage > of pointing to the default environment and setting it as valid, combined > with the change to switch gd->env_valid from 0/1/2 to an enum we now > must set env_valid to one of the enum values rather than an int. And in > this case, not only was setting it to an int wrong, it was now the wrong > value. Finally, in the case of ENV_IS_NOWHERE we must still say that > our envionrment is invalid after init for things to continue to > function. > > Fixes: 7938822a6b75 ("env: Drop common init() functions") > Reported-by: Marek Vasut > Reported-by: Andy Shevchenko > Signed-off-by: Tom Rini Tested-by: Marek Vasut > --- > Changes in v2: > - Also correct env/nowhere.c so that sandbox tests function again. > --- > env/env.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/env/env.c b/env/env.c > index 2b8b9611cfff..8671f13f8d9e 100644 > --- a/env/env.c > +++ b/env/env.c > @@ -138,7 +138,7 @@ int env_init(void) > ret = drv->init(); > if (ret == -ENOENT) { > gd->env_addr = (ulong)&default_environment[0]; > - gd->env_valid = 0; > + gd->env_valid = ENV_VALID; > > return 0; > } else if (ret) { > -- Best regards, Marek Vasut