summaryrefslogtreecommitdiffstats
path: root/drivers/of/platform.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-06-08 15:48:25 +0200
committerGrant Likely <grant.likely@secretlab.ca>2010-07-19 06:39:36 +0200
commit60d599133011eaca6073696f6a86cd516854d547 (patch)
tree224ab8eea128c70db90320372f7dde0d79b95d2f /drivers/of/platform.c
parentof/flattree: Use common ALIGN() macro instead of arch specific _ALIGN (diff)
downloadlinux-60d599133011eaca6073696f6a86cd516854d547.tar.xz
linux-60d599133011eaca6073696f6a86cd516854d547.zip
of/flattree: Fix crash when device tree absent
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>
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r--drivers/of/platform.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 5be008035b94..c52a798684a9 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -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);