Commit f2006808f099: ("dm: core: parse chosen node") added a logic
to parse the chosen node during dm_scan_fdt_node(), but unfortunately
it missed adding the same logic in dm_scan_fdt_live(). This mirrors
the logic in the livetree version.

The weird thing is that commit f2006808f099 did update the test case
to test such logic, but I have no idea how the test case could pass.

With this fix, the following 2 test cases now pass:

Test: dm_test_bus_children: bus.c
test/dm/bus.c:112, dm_test_bus_children(): num_devices ==
list_count_items(&uc->dev_head): Expected 7, got 6

Test: dm_test_fdt: test-fdt.c
test/dm/test-fdt.c:184, dm_test_fdt(): num_devices ==
list_count_items(&uc->dev_head): Expected 7, got 6

Fixes: f2006808f099 ("dm: core: parse chosen node")
Signed-off-by: Bin Meng <bmeng...@gmail.com>
---

 drivers/core/root.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index f918ee1..535084e 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -222,6 +222,16 @@ static int dm_scan_fdt_live(struct udevice *parent,
        int ret = 0, err;
 
        for (np = node_parent->child; np; np = np->sibling) {
+               /* "chosen" node isn't a device itself but may contain some: */
+               if (!strcmp(np->name, "chosen")) {
+                       pr_debug("parsing subnodes of \"chosen\"\n");
+
+                       err = dm_scan_fdt_live(parent, np, pre_reloc_only);
+                       if (err && !ret)
+                               ret = err;
+                       continue;
+               }
+
                if (!of_device_is_available(np)) {
                        pr_debug("   - ignoring disabled device\n");
                        continue;
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to