From: Grant Likely <grant.likely@secretlab.ca>
To: benh@kernel.crashing.org, monstr@monstr.eu
Cc: microblaze-uclinux@itee.uq.edu.au,
devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org, jeremy.kerr@canonical.com,
sfr@canb.auug.org.au
Subject: [PATCH] of/flattree: Fix crash when device tree absent
Date: Fri, 25 Jun 2010 16:03:06 -0600 [thread overview]
Message-ID: <20100625220306.6903.17916.stgit@angua> (raw)
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, and adds an error message if the device tree was unable
to be flattened.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/of/fdt.c | 2 ++
drivers/of/platform.c | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index b6987bb..beda593 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -94,6 +94,8 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
break;
} while (1);
+ if (rc)
+ pr_err("Failed to unflatten device tree blob. rc=%i\n", rc);
return rc;
}
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3eb4cf6..1f5a210 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -640,6 +640,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);
reply other threads:[~2010-06-25 22:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100625220306.6903.17916.stgit@angua \
--to=grant.likely@secretlab.ca \
--cc=benh@kernel.crashing.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=jeremy.kerr@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=microblaze-uclinux@itee.uq.edu.au \
--cc=monstr@monstr.eu \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox