[PATCH 0/3] efi_loader: fix build warnings for initrddump.c

When building with 'make W=1' multipled build warnings were shown.
Heinrich Schuchardt (3): efi_loader: make get_load_options() static efi_loader: fix struct efi_input_key efi_loader: add definition for efi_main()
include/efi_api.h | 12 +++++++++++- lib/efi_loader/initrddump.c | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-)

In program initrddump.efi function get_load_options() can be static.
This avoids a warning when building with 'make W=1':
lib/efi_loader/initrddump.c:442:6: warning: no previous prototype for ‘get_load_options’ [-Wmissing-prototypes] 442 | u16 *get_load_options(void) | ^~~~~~~~~~~~~~~~
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- lib/efi_loader/initrddump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/efi_loader/initrddump.c b/lib/efi_loader/initrddump.c index 9872106981..971a3b6236 100644 --- a/lib/efi_loader/initrddump.c +++ b/lib/efi_loader/initrddump.c @@ -439,7 +439,7 @@ out: * * Return: load options or NULL */ -u16 *get_load_options(void) +static u16 *get_load_options(void) { efi_status_t ret; struct efi_loaded_image *loaded_image;

The UEFI specification defines filed UnicodeChar as CHAR16. We use u16 for CHAR16 throughout our code. The change fixes the following errors:
lib/efi_loader/initrddump.c: In function ‘efi_input’: lib/efi_loader/initrddump.c:218:38: warning: comparison is always false due to limited range of data type [-Wtype-limits] 218 | if (key.unicode_char >= 0xD800 && key.unicode_char <= 0xDBFF) | ^~ lib/efi_loader/initrddump.c:218:68: warning: comparison is always true due to limited range of data type [-Wtype-limits] 218 | if (key.unicode_char >= 0xD800 && key.unicode_char <= 0xDBFF) | ^~
Fixes: 867a6ac86dd8 ("efi: Add start-up library code") Reported-by: Marek Vasut marex@denx.de Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- include/efi_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/efi_api.h b/include/efi_api.h index 9bd70b0f18..e1cdaf5247 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -817,7 +817,7 @@ struct efi_simple_text_output_protocol {
struct efi_input_key { u16 scan_code; - s16 unicode_char; + u16 unicode_char; };
#define EFI_SHIFT_STATE_INVALID 0x00000000

U-Boot provides multiple EFI applications. The entry point is called efi_main(). Provide a definition for this function. This avoids build warnings like
lib/efi_loader/initrddump.c:468:21: warning: no previous prototype for ‘efi_main’ [-Wmissing-prototypes] 468 | efi_status_t EFIAPI efi_main(efi_handle_t image_handle, | ^~~~~~~~
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- include/efi_api.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/efi_api.h b/include/efi_api.h index e1cdaf5247..2d18d25a71 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -513,6 +513,16 @@ struct efi_system_table { struct efi_configuration_table *tables; };
+/** + * efi_main() - entry point of EFI applications + * + * @image_handle: handle with the Loaded Image Protocol + * @systab: pointer to the system table + * Return: status code + */ +efi_status_t EFIAPI efi_main(efi_handle_t image_handle, + struct efi_system_table *systab); + #define EFI_LOADED_IMAGE_PROTOCOL_GUID \ EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \ 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
participants (1)
-
Heinrich Schuchardt