of: base: use of_property_read_string()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Sun, 23 Jul 2017 16:55:48 +0000 (19:55 +0300)
committerRob Herring <robh@kernel.org>
Mon, 24 Jul 2017 14:50:34 +0000 (09:50 -0500)
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...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/base.c

index 830f8d2f359462773d93b6409fba8678261a3224..260d33c0f26c9b290ec2c7f2d03237ebbad7da02 100644 (file)
@@ -1662,11 +1662,13 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align))
 
        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);
        }