[PATCH 05/14] initcall: Adjust the failure message and return value

Michal Simek michal.simek at amd.com
Fri Aug 2 11:21:05 CEST 2024


Hi Simon,

On 3/22/24 11:22, Michal Simek wrote:
> Hi Simon,
> 
> út 22. 8. 2023 v 5:18 odesílatel Simon Glass <sjg at chromium.org 
> <mailto:sjg at chromium.org>> napsal:
> 
>     Move the failure message outside the loop, so it is easier to follow the
>     code. Avoid swallowing the error code - just pass it along.
> 
>     Drop the initcall-list address from the output. This is confusing since
>     we show two addresses. Really it is only the function address which is
>     useful, since it can be looked up in the map, e.g. with:
> 
>         grep -A1 -B1 serial_init u-boot.map
> 
>     Signed-off-by: Simon Glass <sjg at chromium.org <mailto:sjg at chromium.org>>
>     ---
> 
>       lib/initcall.c | 12 +++++++-----
>       1 file changed, 7 insertions(+), 5 deletions(-)
> 
>     diff --git a/lib/initcall.c b/lib/initcall.c
>     index 81c5d2450735..0f74cef32f85 100644
>     --- a/lib/initcall.c
>     +++ b/lib/initcall.c
>     @@ -46,11 +46,13 @@ int initcall_run_list(const init_fnc_t init_sequence[])
>                      }
> 
>                      ret = func();
>     -               if (ret) {
>     -                       printf("initcall sequence %p failed at call %p
>     (err=%d)\n",
>     -                              init_sequence, (char *)func - reloc_ofs, ret);
>     -                       return -1;
>     -               }
>     +       }
>     +
>     +       if (ret) {
>     +               printf("initcall failed at call %p (err=%dE)\n",
>     +                      (char *)func - reloc_ofs, ret);
>     +
>     +               return ret;
>              }
> 
>              return 0;
>     -- 
>     2.42.0.rc1.204.g551eb34607-goog
> 
> 
> I am debugging one issue and I get output like this. And I dig into it and find 
> out that failures are not reported
> on the function which is causing it but on the next one. It is because of 
> pointer is moved to next function;
> 
> This is what I see.
> initcall: 0000000008072de8, 0
> initcall failed at call 000000000802b14c (err=-19)
> 
> And this is the problematic part.
> for (ptr = init_sequence; func = *ptr, !ret && func; ptr++) {
> 
> Fix should be of course to get that if(ret) code back but maybe you want to see 
> different solution.

Any comment on this one?

M


More information about the U-Boot mailing list