Skip to contentSkip to conversation

of: base: Fix of_get_stdoutpath() when property does not contain a colon

PATCH New Ahmad Fatoum 1 participant 1 message Feb 23, 2023 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of: base: Fix of_get_stdoutpath() when property does not contain a colon

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")
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/base.c +2 -2
index 34854d9b0db1..37520709fdd7 100644
@@ -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);
 
Signature · 1 line
2.38.3