[U-Boot] [RFC 2/2] env: Add prefix to error messages when loading env

Sam Protsenko
2018-07-19T20:16:20Z

On Thu, Jul 19, 2018 at 10:52 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Sam,
>
> In message <CAKaJLVuxoS0mz9pDDYqmqomsSfd83kSed=LZ261=wfUUC-Q-Xw@mail.gmail.com> you wrote:
>>
>> Also, I figured how to do prefixing (to display MMC errors as nested
>> w.r.t. "Loading environment), without adding new field to gd. We can
>> just add some new GD_LG_ and print prefix when it's installed. I'm
>> gonna send new RFC soon. Please let me know what you think about [1].
>
> This is IMO a totally wrong approach. We don't want to add more
> code (and more output) jsut to paper over inconsistent error
> reporting. This problem should be fixed at the root cause, i. e.
> we should report errors where they are detected, and only once.
> If all callers can rely that, in the error path, their callees which
> return error codes, have already printed appropriate messages, there
> is no need to print even more lines.
>
> What we need is not fancy code, but consistent (and consequent)
> error handling.
>

As a matter of fact, that was first thing that came into my mind when
I started looking into this (and actually I mentioned that way in my
first RFC, I guess). I will try to investigate it further and come
back with more meaningful patch.

My concern w.r.t. this approach is next: if we suppress consequent
warning messages, there might be some other use-case (other than
loading environment), where there is another caller of that API, and
we would just lose all error messages at all. I'll try to check if we
have such cases as well.

Overall: agree with your review, thanks.

> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> "One day," said a dull voice from down below, "I'm going to be back
> in form again and you're going to be very sorry you said that. For a
> very long time. I might even go so far as to make even more Time just
> for you to be sorry in." - Terry Pratchett, _Small Gods_