[PATCH 3/5] environment: register barebox env OF driver regardless of /chosen

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Nov 26 07:33:10 PST 2024


Even if we don't have a /chosen node, a barebox,environment node may be
added later or it may not be under /chosen at all with the incoming new
binding.

Therefore register the driver unconditionally if we are on an OF system.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/of/barebox.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c
index ed5d171e43a8..65392697913b 100644
--- a/drivers/of/barebox.c
+++ b/drivers/of/barebox.c
@@ -108,13 +108,9 @@ static int barebox_of_driver_init(void)
 		return 0;
 
 	node = of_find_node_by_path("/chosen");
-	if (!node)
-		return 0;
+	if (node)
+		of_platform_populate(node, of_default_bus_match_table, NULL);
 
-	of_platform_populate(node, of_default_bus_match_table, NULL);
-
-	platform_driver_register(&environment_driver);
-
-	return 0;
+	return platform_driver_register(&environment_driver);
 }
 late_initcall(barebox_of_driver_init);
-- 
2.39.5




More information about the barebox mailing list