public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH 3/6] env: Fix invalid env handling in env_init()
Date: Sat, 6 Jun 2020 12:24:17 -0400	[thread overview]
Message-ID: <20200606162417.GL24893@bill-the-cat> (raw)
In-Reply-To: <ac2f9da9-6b11-b021-dde6-b9d5f9cec104@denx.de>

On Sat, Jun 06, 2020 at 04:54:52PM +0200, Marek Vasut wrote:
> On 6/5/20 11:11 PM, Tom Rini wrote:
> > On Fri, Jun 05, 2020 at 10:47:24PM +0200, Marek Vasut wrote:
> >> On 6/5/20 9:07 PM, Tom Rini wrote:
> >>> On Wed, Jun 03, 2020 at 02:01:08AM +0200, Marek Vasut wrote:
> >>>
> >>>> In case the env storage driver marks environment as ENV_INVALID, we must
> >>>> reset the $ret return value to -ENOENT to let the env init code reset the
> >>>> environment to the default one a bit further down.
> >>>>
> >>>> Signed-off-by: Marek Vasut <marex@denx.de>
> >>>> ---
> >>>>  env/env.c | 3 +++
> >>>>  1 file changed, 3 insertions(+)
> >>>>
> >>>> diff --git a/env/env.c b/env/env.c
> >>>> index dcc25c030b..024d36fdbe 100644
> >>>> --- a/env/env.c
> >>>> +++ b/env/env.c
> >>>> @@ -300,6 +300,9 @@ int env_init(void)
> >>>>  
> >>>>  		debug("%s: Environment %s init done (ret=%d)\n", __func__,
> >>>>  		      drv->name, ret);
> >>>> +
> >>>> +		if (gd->env_valid == ENV_INVALID)
> >>>> +			ret = -ENOENT;
> >>>>  	}
> >>>>  
> >>>>  	if (!prio)
> >>>
> >>> Is the storage driver marking the environment as invalid but not
> >>> returning ENOENT valid?
> >>
> >> Yes, some are doing that.
> > 
> > Why?  Is that correct or incorrect?  It doesn't seem like this is
> > something that should be inconsistent from storage driver to storage
> > driver and needs fixing.
> 
> The default env driver is doing it, whether it's a workaround or correct
> behavior, I really don't know. Maybe Joe does ?
> 
> >>> How does all of this work in the case of multiple configured storage
> >>> drivers?
> >>
> >> If the env is invalid, then we report it as invalid.
> > 
> > Right.  And what change, if any, does your proposed change have in this
> > case?  Thanks!
> 
> Before this patch, that check was missing and the result was random,
> depending on which env order you had.

So have you changed the behavior of multiple environments then?  Today
it's indeed link order based, which is not optimal but used.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200606/4c53cc6f/attachment.sig>

  reply	other threads:[~2020-06-06 16:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  0:01 [PATCH 1/6] env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set Marek Vasut
2020-06-03  0:01 ` [PATCH 2/6] env: Add H_DEFAULT flag Marek Vasut
2020-06-05 19:07   ` Tom Rini
2020-06-03  0:01 ` [PATCH 3/6] env: Fix invalid env handling in env_init() Marek Vasut
2020-06-05 19:07   ` Tom Rini
2020-06-05 20:47     ` Marek Vasut
2020-06-05 21:11       ` Tom Rini
2020-06-06 14:54         ` Marek Vasut
2020-06-06 16:24           ` Tom Rini [this message]
2020-06-08 21:45             ` Marek Vasut
2020-06-08 22:57               ` Tom Rini
2020-06-09  1:50                 ` Marek Vasut
2020-06-09 15:06                   ` Tom Rini
2020-06-03  0:01 ` [PATCH 4/6] env: nowhere: Implement .load callback Marek Vasut
2020-06-05 19:07   ` Tom Rini
2020-06-03  0:01 ` [PATCH 5/6] env: Add option to only ever append environment Marek Vasut
2020-06-05 19:07   ` Tom Rini
2020-06-03  0:01 ` [PATCH 6/6] env: Add support for explicit write access list Marek Vasut
2020-06-05 19:07   ` Tom Rini
2020-06-05 20:48     ` Marek Vasut
2020-06-25 18:12   ` Harald Seiler
2020-06-25 21:42     ` Tom Rini
2020-06-05 19:07 ` [PATCH 1/6] env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200606162417.GL24893@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox