lib: utils/reset: Try initializing all reset devices in dt

In DT, multiple reset devices may use the same driver, and they
may have different priorities. If rc is returned after the first
initialization, the highest priority device may be lost.

Fixes: a73ff043e9 (lib: utils/reset: Fix fdt_reset to search for more dt nodes)
Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Xiang W 2024-06-13 23:03:07 +08:00 committed by Anup Patel
parent 3a94a32580
commit 62e178a0a7
1 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,7 @@ extern unsigned long fdt_reset_drivers_size;
int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
{
int noff, rc = SBI_ENODEV;
int noff, rc, cnt = 0;
const struct fdt_match *match;
noff = -1;
@ -30,16 +30,16 @@ int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
if (drv->init) {
rc = drv->init(fdt, noff, match);
if (rc && rc != SBI_ENODEV) {
if (!rc)
cnt++;
else if (rc != SBI_ENODEV) {
sbi_printf("%s: %s init failed, %d\n",
__func__, match->compatible, rc);
}
}
return rc;
}
return SBI_ENODEV;
return cnt > 0 ? 0 : SBI_ENODEV;
}
void fdt_reset_init(void)