[PATCH master] of: base: Fix of_get_stdoutpath() when property does not contain a colon

Ahmad Fatoum ahmad at a3f.at
Thu Feb 23 02:41:36 PST 2023


Initial state of patch accounted for lack of colon by skipping xstrdup
in that case. Too much time went by that I forgot before upstreaming,
 why I did it that way and thus value ended up being dropped...
 Fix this to restore console for devices which lack : in their
 stdout-path.

Fixes: 90f70dbe2958 ("of: split part of of_get_stdoutpath into of_find_node_by_chosen")
Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 34854d9b0db1..37520709fdd7 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2689,9 +2689,9 @@ struct device_node *of_find_node_by_chosen(const char *propname,
 
 	p = strchrnul(value, ':');
 	if (*p)
-		buf = xstrndup(value, p - value);
+		value = buf = xstrndup(value, p - value);
 
-	dn = of_find_node_by_path_or_alias(NULL, buf);
+	dn = of_find_node_by_path_or_alias(NULL, value);
 
 	free(buf);
 
-- 
2.38.3




More information about the barebox mailing list