[PATCH v2] initcall: break loop immediately on failure
Tom Rini
trini at konsulko.com
Thu Mar 14 01:39:48 CET 2024
On Tue, Mar 05, 2024 at 02:55:13PM +0000, Caleb Connolly wrote:
> The current ordering always results in func pointing to the next
> function in the init_sequence. e.g. if fdtdec_setup() fails, ret will
> be set to the error code, then func will be updated to point to
> initf_malloc(), only then is ret checked and the loop broken. The end
> result of this is that the "initcall failed at ..." error will point you
> to initf_malloc(), when the error actually occured in fdtdec_setup()!
>
> This can be quite confusing and result in a lot of time wasted debugging
> code that has nothing to do with the failure (ask me how I know :P).
>
> Adjust the for loop to check ret immediately after the call and break
> early so that func will correctly reference the failed function.
>
> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> Reviewed-by: Dan Carpenter <dan.carpenter at linaro.org>
Applied to u-boot/next, thanks!
--
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/20240313/0521283b/attachment.sig>
More information about the U-Boot
mailing list