From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org
Subject: [PATCH 2/3] of/flattree: Fix crash when device tree absent
Date: Wed, 14 Jul 2010 17:31:36 -0600 [thread overview]
Message-ID: <20100714233136.21887.27766.stgit@angua> (raw)
In-Reply-To: <20100714233130.21887.73872.stgit@angua>
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-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
---
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 d61fda8..66401bc 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 f0ca906..9bc6999 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -674,6 +674,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);
next prev parent reply other threads:[~2010-07-14 23:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 23:31 [PATCH 1/3] of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN Grant Likely
2010-07-14 23:31 ` Grant Likely [this message]
2010-07-15 1:11 ` [PATCH 2/3] of/flattree: Fix crash when device tree absent Jeremy Kerr
[not found] ` <1279156262.15089.68.camel-353AF/3W9ll+urZeOPWqwQ@public.gmane.org>
2010-07-15 6:15 ` Grant Likely
[not found] ` <AANLkTikD3ZhhVg4PTuG5Zkc38oW1I6yaQyKqcv9rAaoR-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-15 7:26 ` Jeremy Kerr
2010-07-19 0:04 ` Benjamin Herrenschmidt
2010-07-19 4:37 ` Grant Likely
2010-07-14 23:31 ` [PATCH 3/3] of: Remove unused of_find_device_by_phandle() Grant Likely
2010-07-19 0:06 ` Benjamin Herrenschmidt
2010-07-15 1:12 ` [PATCH 1/3] of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN Jeremy Kerr
2010-07-19 0:03 ` Benjamin Herrenschmidt
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=20100714233136.21887.27766.stgit@angua \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).