[U-Boot] [PATCH 1/1] efi_loader: efi_set_variable use const void *

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Dec 30 20:03:15 UTC 2018


The SetVariable() runtime service does not change the data passed to it.
So mark the parameter as constant.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 include/efi_api.h             | 3 ++-
 include/efi_loader.h          | 2 +-
 lib/efi_loader/efi_variable.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 323797565e..9b6b97457b 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -231,7 +231,8 @@ struct efi_runtime_services {
 	efi_status_t (EFIAPI *set_variable)(u16 *variable_name,
 					    const efi_guid_t *vendor,
 					    u32 attributes,
-					    efi_uintn_t data_size, void *data);
+					    efi_uintn_t data_size,
+					    const void *data);
 	efi_status_t (EFIAPI *get_next_high_mono_count)(
 			uint32_t *high_count);
 	void (EFIAPI *reset_system)(enum efi_reset_type reset_type,
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 907fb2b8c1..01092651fb 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -526,7 +526,7 @@ efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
 					       const efi_guid_t *vendor);
 efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 				     const efi_guid_t *vendor, u32 attributes,
-				     efi_uintn_t data_size, void *data);
+				     efi_uintn_t data_size, const void *data);
 
 /**
  * struct efi_load_option - EFI load option
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 4e6a04e614..c302dbd2fe 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -254,7 +254,7 @@ efi_status_t EFIAPI efi_get_next_variable_name(efi_uintn_t *variable_name_size,
 /* http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES#SetVariable.28.29 */
 efi_status_t EFIAPI efi_set_variable(u16 *variable_name,
 				     const efi_guid_t *vendor, u32 attributes,
-				     efi_uintn_t data_size, void *data)
+				     efi_uintn_t data_size, const void *data)
 {
 	char *native_name = NULL, *val = NULL, *s;
 	efi_status_t ret = EFI_SUCCESS;
-- 
2.19.2



More information about the U-Boot mailing list