[U-Boot] [PATCH v2 3/7] efi_loader: Return non-zero for error in efi_add_memory_map()

Bryan O'Donoghue pure.logic at nexus-software.ie
Sun Jul 14 22:29:27 UTC 2019


The previous implementation of efi_add_memory_map() returned the passed
address on success, instead of an efi_status_t.

With the new function signature instead of returning zero, return
EFI_NO_MAPPING on carve-out errors.

Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map")
Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes")
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Alexander Graf <agraf at csgraf.de>
Signed-off-by: Bryan O'Donoghue <pure.logic at nexus-software.ie>
---
 lib/efi_loader/efi_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index b513553fa4..c1d7b88997 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -277,7 +277,7 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
 				 * The user requested to only have RAM overlaps,
 				 * but we hit a non-RAM region. Error out.
 				 */
-				return 0;
+				return EFI_NO_MAPPING;
 			case EFI_CARVE_NO_OVERLAP:
 				/* Just ignore this list entry */
 				break;
@@ -307,7 +307,7 @@ efi_status_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
 		 * The payload wanted to have RAM overlaps, but we overlapped
 		 * with an unallocated region. Error out.
 		 */
-		return 0;
+		return EFI_NO_MAPPING;
 	}
 
 	/* Add our new map */
-- 
2.22.0



More information about the U-Boot mailing list