Patchwork [U-Boot,v2,23/45] fdt: Skip checking FDT if the pointer is NULL

login
register
mail settings
Submitter Simon Glass
Date March 18, 2013, 11:51 p.m.
Message ID <1363650725-30459-24-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/228851/
State Deferred
Delegated to: Tom Rini
Headers show

Comments

Simon Glass - March 18, 2013, 11:51 p.m.
If we have no FDT, don't attempt to read from it. This allows sandbox to
run without an FDT if required.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- Fix checkpatch checks about parenthesis alignment

 lib/fdtdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 3ae348d..8e1542b 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -329,7 +329,8 @@  int fdtdec_check_fdt(void)
  */
 int fdtdec_prepare_fdt(void)
 {
-	if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(gd->fdt_blob)) {
+	if (!gd->fdt_blob || ((uintptr_t)gd->fdt_blob & 3) ||
+	    fdt_check_header(gd->fdt_blob)) {
 		printf("No valid FDT found - please append one to U-Boot "
 			"binary, use u-boot-dtb.bin or define "
 			"CONFIG_OF_EMBED\n");