drivers/intel/fsp1_1: Replace for/break with returns

Coverity does not like the use of for/break, switch to using returns
instead.

Found-by: Coverity CID 1349855

TEST=Build and run on Galileo Gen2

Change-Id: I4e5767b09faefa275dd32d3b76dda063f7c22f6f
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-on: https://review.coreboot.org/14869
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Lee Leahy 2016-05-17 08:57:42 -07:00 committed by Leroy P Leahy
parent c1cbc605cd
commit 00c35c1a98
1 changed files with 44 additions and 52 deletions

View File

@ -41,14 +41,12 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
u32 *image_id; u32 *image_id;
for (;;) {
/* Get the FSP binary base address in CBFS */ /* Get the FSP binary base address in CBFS */
fsp_ptr.u32 = fsp_base_address; fsp_ptr.u32 = fsp_base_address;
/* Check the FV signature, _FVH */ /* Check the FV signature, _FVH */
if (fsp_ptr.fvh->Signature != 0x4856465F) { if (fsp_ptr.fvh->Signature != 0x4856465F) {
fsp_ptr.u8 = (u8 *)ERROR_NO_FV_SIG; return (FSP_INFO_HEADER *)ERROR_NO_FV_SIG;
break;
} }
/* Locate the file header which follows the FV header. */ /* Locate the file header which follows the FV header. */
@ -61,16 +59,14 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
|| (((u32 *)&fsp_ptr.ffh->Name)[1] != 0x47342284) || (((u32 *)&fsp_ptr.ffh->Name)[1] != 0x47342284)
|| (((u32 *)&fsp_ptr.ffh->Name)[2] != 0xB08471B9) || (((u32 *)&fsp_ptr.ffh->Name)[2] != 0xB08471B9)
|| (((u32 *)&fsp_ptr.ffh->Name)[3] != 0x0C3F3527)) { || (((u32 *)&fsp_ptr.ffh->Name)[3] != 0x0C3F3527)) {
fsp_ptr.u8 = (u8 *)ERROR_NO_FFS_GUID; return (FSP_INFO_HEADER *)ERROR_NO_FFS_GUID;
break;
} }
/* Locate the Raw Section Header */ /* Locate the Raw Section Header */
fsp_ptr.u8 += sizeof(EFI_FFS_FILE_HEADER); fsp_ptr.u8 += sizeof(EFI_FFS_FILE_HEADER);
if (fsp_ptr.rs->Type != EFI_SECTION_RAW) { if (fsp_ptr.rs->Type != EFI_SECTION_RAW) {
fsp_ptr.u8 = (u8 *)ERROR_NO_INFO_HEADER; return (FSP_INFO_HEADER *)ERROR_NO_INFO_HEADER;
break;
} }
/* Locate the FSP INFO Header which follows the Raw Header. */ /* Locate the FSP INFO Header which follows the Raw Header. */
@ -78,23 +74,19 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
/* Verify that the FSP base address.*/ /* Verify that the FSP base address.*/
if (fsp_ptr.fih->ImageBase != fsp_base_address) { if (fsp_ptr.fih->ImageBase != fsp_base_address) {
fsp_ptr.u8 = (u8 *)ERROR_IMAGEBASE_MISMATCH; return (FSP_INFO_HEADER *)ERROR_IMAGEBASE_MISMATCH;
break;
} }
/* Verify the FSP Signature */ /* Verify the FSP Signature */
if (fsp_ptr.fih->Signature != FSP_SIG) { if (fsp_ptr.fih->Signature != FSP_SIG) {
fsp_ptr.u8 = (u8 *)ERROR_INFO_HEAD_SIG_MISMATCH; return (FSP_INFO_HEADER *)ERROR_INFO_HEAD_SIG_MISMATCH;
break;
} }
/* Verify the FSP ID */ /* Verify the FSP ID */
image_id = (u32 *)&fsp_ptr.fih->ImageId[0]; image_id = (u32 *)&fsp_ptr.fih->ImageId[0];
if ((image_id[0] != fsp_id.int_id[0]) if ((image_id[0] != fsp_id.int_id[0])
|| (image_id[1] != fsp_id.int_id[1])) || (image_id[1] != fsp_id.int_id[1]))
fsp_ptr.u8 = (u8 *)ERROR_FSP_SIG_MISMATCH; return (FSP_INFO_HEADER *)ERROR_FSP_SIG_MISMATCH;
break;
}
return fsp_ptr.fih; return fsp_ptr.fih;
} }