forked from Mirrors/opensbi
lib: utils/reset: Fix fdt_reset to search for more dt nodes
If there are multiple dt nodes, the previous code only tries to match the first one, which may lose initialization. Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -22,12 +22,11 @@ int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
|
|||||||
int noff, rc = SBI_ENODEV;
|
int noff, rc = SBI_ENODEV;
|
||||||
const struct fdt_match *match;
|
const struct fdt_match *match;
|
||||||
|
|
||||||
noff = fdt_find_match(fdt, -1, drv->match_table, &match);
|
noff = -1;
|
||||||
if (noff < 0)
|
while ((noff = fdt_find_match(fdt, noff,
|
||||||
return SBI_ENODEV;
|
drv->match_table, &match)) >= 0) {
|
||||||
|
|
||||||
if (!fdt_node_is_enabled(fdt, noff))
|
if (!fdt_node_is_enabled(fdt, noff))
|
||||||
return SBI_ENODEV;
|
continue;
|
||||||
|
|
||||||
if (drv->init) {
|
if (drv->init) {
|
||||||
rc = drv->init(fdt, noff, match);
|
rc = drv->init(fdt, noff, match);
|
||||||
@@ -40,6 +39,9 @@ int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SBI_ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
void fdt_reset_init(void)
|
void fdt_reset_init(void)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
Reference in New Issue
Block a user