From cb665f932e1ae17c8f0eda14d11ffbf598e2f17a Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Tue, 10 Sep 2024 13:28:30 +0800 Subject: [PATCH] [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> --- components/drivers/ofw/ofw.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/drivers/ofw/ofw.c b/components/drivers/ofw/ofw.c index 1f9a456aff..f35101ccfe 100644 --- a/components/drivers/ofw/ofw.c +++ b/components/drivers/ofw/ofw.c @@ -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]; - 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_strcmp(item->cells_name, cells_name)) + { + ret_obj = obj; + break; + } + obj = (struct rt_object *)((rt_ubase_t)obj + item->obj_size); 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) { /* 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; }