aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang W <wxjstz@126.com>2024-06-13 23:03:07 +0800
committerAnup Patel <anup@brainfault.org>2024-06-13 21:48:03 +0530
commit62e178a0a7b989d7cab9b2d4e33b291bc9a58c65 (patch)
treed085d33a7c43bb02a4c962f48899894a74c68f8f
parent3a94a3258039f225d068cb575844062c3f86bc03 (diff)
downloadopensbi-62e178a0a7b989d7cab9b2d4e33b291bc9a58c65.zip
opensbi-62e178a0a7b989d7cab9b2d4e33b291bc9a58c65.tar.gz
opensbi-62e178a0a7b989d7cab9b2d4e33b291bc9a58c65.tar.bz2
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: a73ff043e991 (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>
-rw-r--r--lib/utils/reset/fdt_reset.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/utils/reset/fdt_reset.c b/lib/utils/reset/fdt_reset.c
index c41b838..ee4e29a 100644
--- a/lib/utils/reset/fdt_reset.c
+++ b/lib/utils/reset/fdt_reset.c
@@ -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)