Skip to contentSkip to conversation

of: base: use of_property_read_string()

PATCH In review Sergei Shtylyov 2 participants 2 messages Jul 23, 2017 – Jul 24, 2017 1 message not in the archive Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 of: base: use of_property_read_string()

of_alias_scan() can use of_property_read_string() -- using the modern DT API adds some prop sanity checks as a bonus; it does add couple LoCs but only because the original code violated the 80-column limit...

---
 drivers/of/base.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/of/base.c +6 -4
Index: linux/drivers/of/base.c
===================================================================
@@ -1662,11 +1662,13 @@ void of_alias_scan(void * (*dt_alloc)(u6
 
 	if (of_chosen) {
 		/* linux,stdout-path and /aliases/stdout are for legacy compatibility */
-		const char *name = of_get_property(of_chosen, "stdout-path", NULL);
-		if (!name)
-			name = of_get_property(of_chosen, "linux,stdout-path", NULL);
+		const char *name = NULL;
+
+		if (of_property_read_string(of_chosen, "stdout-path", &name))
+			of_property_read_string(of_chosen, "linux,stdout-path",
+						&name);
 		if (IS_ENABLED(CONFIG_PPC) && !name)
-			name = of_get_property(of_aliases, "stdout", NULL);
+			of_property_read_string(of_aliases, "stdout", &name);
 		if (name)
 			of_stdout = of_find_node_opts_by_path(name, &of_stdout_options);
 	}

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170723165748.078949611-M4DtvfQ/[email protected]

#2 lore raw
Quoted 9 lines · Sergei Shtylyov

of_alias_scan() can use of_property_read_string() -- using the modern DT API adds some prop sanity checks as a bonus; it does add couple LoCs but only because the original code violated the 80-column limit...

---
 drivers/of/base.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Both applied, thanks.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html