From ac49aaf0f948fec9c57c6e19ad706dedf0856960 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 22 Mar 2022 12:17:48 +0100 Subject: drivers/intel/fsp1_1: Fix code not working with strict-aliasing rules Change-Id: Ifc95a093cf86c834d63825bf76312ed21ec68215 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/62995 Tested-by: build bot (Jenkins) Reviewed-by: Frans Hendriks Reviewed-by: Arthur Heymans --- src/drivers/intel/fsp1_1/hob.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/intel/fsp1_1/hob.c b/src/drivers/intel/fsp1_1/hob.c index 9a09cfd81a..076dd5f768 100644 --- a/src/drivers/intel/fsp1_1/hob.c +++ b/src/drivers/intel/fsp1_1/hob.c @@ -257,21 +257,19 @@ static const char *get_hob_type_string(void *hob_ptr) */ 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 @@ void print_hob_type_structure(u16 hob_type, void *hob_list_ptr) 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"); } -- cgit v1.2.3