diff mbox

[U-Boot,v3,11/17] fdt: Skip checking FDT if the pointer is NULL

Message ID 1366483372-16523-12-git-send-email-sjg@chromium.org
State Accepted, archived
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass April 20, 2013, 6:42 p.m. UTC
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 v3: None
Changes in v2:
- Fix checkpatch checks about parenthesis alignment

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

Comments

Jerry Van Baren May 6, 2013, 11:43 p.m. UTC | #1
On 04/20/2013 02:42 PM, Simon Glass wrote:
> 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>

Acked-by: Gerald Van Baren <vanbaren@cideas.com>

> ---
> Changes in v3: None
> Changes in v2:
> - Fix checkpatch checks about parenthesis alignment
>
>   lib/fdtdec.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 60369fb..ac1fe0b 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -354,7 +354,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. For sandbox, use -d <file.dtb>\n");