diff mbox series

[U-Boot,v8,23/30] efi: Drop error return in efi_carve_out_dt_rsv()

Message ID 20180618140835.195901-24-sjg@chromium.org
State Accepted
Delegated to: Alexander Graf
Headers show
Series efi: Enable sandbox support for EFI loader | expand

Commit Message

Simon Glass June 18, 2018, 2:08 p.m. UTC
This function currently returns an error code, but never uses it. There is
no function comment so it is not obvious why. Presuambly the error is not
important.

Update the function to explain its purpose and why it ignores the error.
Drop the useful error return value.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 cmd/bootefi.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

Comments

Alexander Graf June 18, 2018, 3:01 p.m. UTC | #1
On 06/18/2018 04:08 PM, Simon Glass wrote:
> This function currently returns an error code, but never uses it. There is
> no function comment so it is not obvious why. Presuambly the error is not
> important.
>
> Update the function to explain its purpose and why it ignores the error.
> Drop the useful error return value.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Alexander Graf <agraf@suse.de>


Alex
Alexander Graf June 21, 2018, 5:31 p.m. UTC | #2
> This function currently returns an error code, but never uses it. There is
> no function comment so it is not obvious why. Presuambly the error is not
> important.
> 
> Update the function to explain its purpose and why it ignores the error.
> Drop the useful error return value.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Alexander Graf <agraf@suse.de>

Thanks, applied to efi-next

Alex
diff mbox series

Patch

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 5ef2d8499c..7c41b641f6 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -214,8 +214,16 @@  static efi_status_t efi_run_in_el2(EFIAPI efi_status_t (*entry)(
 }
 #endif
 
-/* Carve out DT reserved memory ranges */
-static efi_status_t efi_carve_out_dt_rsv(void *fdt)
+/*
+ * efi_carve_out_dt_rsv() - Carve out DT reserved memory ranges
+ *
+ * The mem_rsv entries of the FDT are added to the memory map. Any failures are
+ * ignored because this is not critical and we would rather continue to try to
+ * boot.
+ *
+ * @fdt: Pointer to device tree
+ */
+static void efi_carve_out_dt_rsv(void *fdt)
 {
 	int nr_rsv, i;
 	uint64_t addr, size, pages;
@@ -228,11 +236,10 @@  static efi_status_t efi_carve_out_dt_rsv(void *fdt)
 			continue;
 
 		pages = ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT;
-		efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
-				   false);
+		if (!efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE,
+					false))
+			printf("FDT memrsv map %d: Failed to add to map\n", i);
 	}
-
-	return EFI_SUCCESS;
 }
 
 static efi_status_t efi_install_fdt(ulong fdt_addr)
@@ -261,10 +268,7 @@  static efi_status_t efi_install_fdt(ulong fdt_addr)
 		return EFI_LOAD_ERROR;
 	}
 
-	if (efi_carve_out_dt_rsv(fdt) != EFI_SUCCESS) {
-		printf("ERROR: failed to carve out memory\n");
-		return EFI_LOAD_ERROR;
-	}
+	efi_carve_out_dt_rsv(fdt);
 
 	/* Link to it in the efi tables */
 	ret = efi_install_configuration_table(&efi_guid_fdt, fdt);