mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 09:54:35 +00:00
initcall: break loop immediately on failure
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@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
This commit is contained in:
parent
421359ac52
commit
7554388c1d
1 changed files with 3 additions and 1 deletions
|
@ -55,7 +55,7 @@ int initcall_run_list(const init_fnc_t init_sequence[])
|
|||
init_fnc_t func;
|
||||
int ret = 0;
|
||||
|
||||
for (ptr = init_sequence; func = *ptr, !ret && func; ptr++) {
|
||||
for (ptr = init_sequence; func = *ptr, func; ptr++) {
|
||||
type = initcall_is_event(func);
|
||||
|
||||
if (type) {
|
||||
|
@ -71,6 +71,8 @@ int initcall_run_list(const init_fnc_t init_sequence[])
|
|||
}
|
||||
|
||||
ret = type ? event_notify_null(type) : func();
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
|
|
Loading…
Add table
Reference in a new issue