[FIXUP/OFW] ofw_parse_object fail

The ofw parse should:
1. Check obj_name EQU the current node's rt_data.
2. Find the next object name.
3. goto "2" until obj_name EQU the cmp_cell's obj_name.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
GuEe-GUI 2024-09-10 13:28:30 +08:00 committed by Meco Man
parent 8c456c5e33
commit cb665f932e
1 changed files with 7 additions and 7 deletions

View File

@ -103,14 +103,14 @@ static struct rt_object *ofw_parse_object(struct rt_ofw_node *np, const char *ce
{ {
item = &ofw_obj_cmp_list[i]; item = &ofw_obj_cmp_list[i];
if (!rt_strcmp(item->cells_name, cells_name))
{
ret_obj = obj;
break;
}
if (!rt_strncmp(item->obj_name, obj->name, RT_NAME_MAX)) if (!rt_strncmp(item->obj_name, obj->name, RT_NAME_MAX))
{ {
if (!rt_strcmp(item->cells_name, cells_name))
{
ret_obj = obj;
break;
}
obj = (struct rt_object *)((rt_ubase_t)obj + item->obj_size); obj = (struct rt_object *)((rt_ubase_t)obj + item->obj_size);
break; break;
} }
@ -134,7 +134,7 @@ struct rt_object *rt_ofw_parse_object(struct rt_ofw_node *np, const char *obj_na
if (np && (test_obj = rt_ofw_data(np)) && cells_name) if (np && (test_obj = rt_ofw_data(np)) && cells_name)
{ {
/* The composite object is rare, so we try to find this object as much as possible at once. */ /* The composite object is rare, so we try to find this object as much as possible at once. */
if (obj_name && rt_strcmp(test_obj->name, obj_name)) if (obj_name && !rt_strcmp(test_obj->name, obj_name))
{ {
obj = test_obj; obj = test_obj;
} }