drivers/intel/fsp1_1: Fix code not working with strict-aliasing rules

Change-Id: Ifc95a093cf86c834d63825bf76312ed21ec68215
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62995
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/drivers/intel/fsp1_1/hob.c b/src/drivers/intel/fsp1_1/hob.c
index 9a09cfd..076dd5f 100644
--- a/src/drivers/intel/fsp1_1/hob.c
+++ b/src/drivers/intel/fsp1_1/hob.c
@@ -257,21 +257,19 @@
  */
 void print_hob_type_structure(u16 hob_type, void *hob_list_ptr)
 {
-	u32 *current_hob;
-	u32 *next_hob = 0;
-	u8  last_hob = 0;
+	void *current_hob;
 	u32 current_type;
 	const char *current_type_str;
 
-	current_hob = hob_list_ptr;
-
 	/*
 	 * Print out HOBs of our desired type until
 	 * the end of the HOB list
 	 */
 	printk(BIOS_DEBUG, "\n=== FSP HOB Data Structure ===\n");
 	printk(BIOS_DEBUG, "%p: hob_list_ptr\n", hob_list_ptr);
-	do {
+	for (current_hob = hob_list_ptr; !END_OF_HOB_LIST(current_hob);
+	    current_hob = GET_NEXT_HOB(current_hob)) {
+
 		EFI_HOB_GENERIC_HEADER *current_header_ptr =
 			(EFI_HOB_GENERIC_HEADER *)current_hob;
 
@@ -292,16 +290,6 @@
 				break;
 			}
 		}
-
-		/* Check for end of HOB list */
-		last_hob = END_OF_HOB_LIST(current_hob);
-		if (!last_hob) {
-			/* Get next HOB pointer */
-			next_hob = GET_NEXT_HOB(current_hob);
-
-			/* Start on next HOB */
-			current_hob = next_hob;
-		}
-	} while (!last_hob);
+	}
 	printk(BIOS_DEBUG, "=== End of FSP HOB Data Structure ===\n\n");
 }