From patchwork Sat Jan 5 01:51:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,RFC,23/44] fdt: Skip checking FDT if the pointer is NULL From: Simon Glass X-Patchwork-Id: 209606 Message-Id: <1357350734-13737-24-git-send-email-sjg@chromium.org> To: U-Boot Mailing List Cc: Joel A Fernandes , Jerry Van Baren , Tom Rini , Vadim Bendebury , =?UTF-8?q?Andreas=20B=C3=A4ck?= Date: Fri, 4 Jan 2013 17:51:52 -0800 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 --- lib/fdtdec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 6dba438..740bd56 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -318,7 +318,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");