From: Grant Likely Date: Tue, 8 Jun 2010 13:48:25 +0000 (-0600) Subject: of/flattree: Fix crash when device tree absent X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=60d599133011eaca6073696f6a86cd516854d547;p=linux-beck.git 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 --- 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);