From: Stephen Warren Date: Tue, 1 Nov 2011 10:28:20 -0600 Subject: [U-Boot] [PATCH v2 1/3] image: Make image_get_fdt work like image_get_{ram_disk, kernel} Message-ID: <1320164902-24190-1-git-send-email-swarren@nvidia.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de image_get_ram_disk() and image_get_kernel() perform operations in a consistent order. Modify image_get_fdt() to do things the same way. This allows a later change to insert some image header manipulations into these three functions in a consistent fashion. v2: New patch Signed-off-by: Stephen Warren --- common/image.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/image.c b/common/image.c index 555d9d9..b773505 100644 --- a/common/image.c +++ b/common/image.c @@ -1131,14 +1131,19 @@ static const image_header_t *image_get_fdt(ulong fdt_addr) { const image_header_t *fdt_hdr = (const image_header_t *)fdt_addr; - image_print_contents(fdt_hdr); + if (!image_check_magic(fdt_hdr)) { + fdt_error("fdt header bad magic number\n"); + return NULL; + } - puts(" Verifying Checksum ... "); if (!image_check_hcrc(fdt_hdr)) { fdt_error("fdt header checksum invalid"); return NULL; } + image_print_contents(fdt_hdr); + + puts(" Verifying Checksum ... "); if (!image_check_dcrc(fdt_hdr)) { fdt_error("fdt checksum invalid"); return NULL; -- 1.7.0.4