[PATCH] of: platform: don't fail of_find_device_by_node() if no driver bound

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Sep 14 00:30:18 PDT 2023


of_find_device_by_node() may be called by a driver following
of_platform_populate in order to bind the children to drivers.
It's thus wrong to return NULL when a device has been found, but no
driver was registered. That also aligns the function with the
expectation resulting from its name: A device is found and devices may
be bound or not.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/of/platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index bd5f2ad82c6b..1f79a539f541 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -23,11 +23,9 @@
 struct device *of_find_device_by_node(struct device_node *np)
 {
 	struct device *dev;
-	int ret;
 
-	ret = of_device_ensure_probed(np);
-	if (ret)
-		return NULL;
+	/* Not having a driver is not an error here */
+	(void)of_device_ensure_probed(np);
 
 	if (deep_probe_is_supported())
 		return np->dev;
-- 
2.39.2




More information about the barebox mailing list