From 9319a8a11a6fcebc87109f8bf0f5dc362dd1fe07 Mon Sep 17 00:00:00 2001 From: Mitchell Horne Date: Fri, 8 Mar 2024 10:09:17 -0400 Subject: [PATCH] simple_mfd: don't attach children twice Trying to probe+attach the child device at the point it is added comes before the syscon handle is set up (if relevant). It will therefore be unavailable to the attach method which is expecting it, and the first attempt to attach the device will fail. Just rely on the call to bus_generic_attach() at the end of the function to perform probe+attach of dev's children. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44268 (cherry picked from commit accda781531788a814bc438e1e96ef544c12aeaf) --- sys/dev/fdt/simple_mfd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/fdt/simple_mfd.c b/sys/dev/fdt/simple_mfd.c index 888de7756f3..865cd0e2b9a 100644 --- a/sys/dev/fdt/simple_mfd.c +++ b/sys/dev/fdt/simple_mfd.c @@ -169,7 +169,6 @@ simple_mfd_attach(device_t dev) { struct simple_mfd_softc *sc; phandle_t node, child; - device_t cdev; int rid; sc = device_get_softc(dev); @@ -204,9 +203,7 @@ simple_mfd_attach(device_t dev) /* Attach child devices */ for (child = OF_child(node); child > 0; child = OF_peer(child)) { - cdev = simple_mfd_add_device(dev, child, 0, NULL, -1, NULL); - if (cdev != NULL) - device_probe_and_attach(cdev); + (void)simple_mfd_add_device(dev, child, 0, NULL, -1, NULL); } if (ofw_bus_is_compatible(dev, "syscon")) {