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 <swar...@nvidia.com>
---
 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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to