diff --git a/fdtextract.c b/fdtextract.c
index 4308645d2416a16a5767a04aa8cab09fe462d8a5..d134e9011dc1702e8374c951fbaec754e876a2c7 100644
--- a/fdtextract.c
+++ b/fdtextract.c
@@ -149,7 +149,8 @@ static int get_hash(char *buf, char *name)
 {
 	char path[MAX_PATH_LEN];
 	int noffset, i;
-	uint8_t *val;
+	uint8_t *val = NULL;
+	const char *algo;
 
 	snprintf(path, MAX_PATH_LEN, "/images/%s/hash-1", name);
 	noffset = fdt_path_offset(buf, path);
@@ -158,15 +159,17 @@ static int get_hash(char *buf, char *name)
 		return -1;
 	}
 
-	val = (uint8_t *)fdt_getprop(buf, noffset, "algo", NULL);
-	if (strcmp((const char *)val, "sha256")) {
+	algo = fdt_getprop(buf, noffset, "algo", NULL);
+	if (strcmp(algo, "sha256")) {
 		printf("Error: unknown hash algorithm %s\n", val);
 		return -1;
 	}
 
 	val = (uint8_t *)fdt_getprop(buf, noffset, "value", NULL);
+	printf("%s ", algo);
 	for (i=0; i<SHA_256_LEN; i++)
 		printf("%x", val[i]);
+	printf("\n");
 
 	return 0;
 }