瀏覽代碼

[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>
GuEe-GUI 7 月之前
父節點
當前提交
cb665f932e
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      components/drivers/ofw/ofw.c

+ 7 - 7
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;
         }