diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 32c29e55a37bc829d16226590d94f63adc934ef0..a6499e8dd9bc3fc853606567c847d0a064f02e55 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -779,9 +779,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 
 			checksum = ntohl(hdr->ih_dcrc);
 			addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t));
-			len = ntohl(hdr->ih_size);
 
-			if(checksum != crc32(0, (uchar *)addr, len)) {
+			if(checksum != crc32(0, (uchar *)addr, ntohl(hdr->ih_size))) {
 				printf("ERROR: Flat Device Tree checksum is invalid\n");
 				return;
 			}