]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
of/flattree: Fix crash when device tree absent
authorGrant Likely <grant.likely@secretlab.ca>
Tue, 8 Jun 2010 13:48:25 +0000 (07:48 -0600)
committerGrant Likely <grant.likely@secretlab.ca>
Mon, 19 Jul 2010 04:39:36 +0000 (22:39 -0600)
This patch fixes the condition where device tree support is compiled
in, but no device tree was proved by firmware.  It makes
of_platform_bus_probe() explicitly check for a NULL device tree
pointer.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/of/platform.c

index 5be008035b940feb4c99d96609c5d4c4c1042f20..c52a798684a994b8c01f9e6331b76bec96be80c7 100644 (file)
@@ -617,6 +617,8 @@ int of_platform_bus_probe(struct device_node *root,
                root = of_find_node_by_path("/");
        else
                of_node_get(root);
+       if (root == NULL)
+               return -EINVAL;
 
        pr_debug("of_platform_bus_probe()\n");
        pr_debug(" starting at: %s\n", root->full_name);