[PATCH v2 072/113] efi-stdio: fix wait_for_event argument

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Mar 4 10:59:57 PST 2024


EFI v2.10 documents the following about EFI events:

  | // EFI_EVENT: Handle to an event structure. Type VOID *
  |
  | typedef
  | EFI_STATUS
  | (EFIAPI *EFI_WAIT_FOR_EVENT) (
  | 	IN UINTN NumberOfEvents,
  | 	IN EFI_EVENT *Event,
  | 	OUT UINTN *Index
  | );
  |
  | typedef struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL {
  |     EFI_INPUT_RESET Reset;
  |     EFI_INPUT_READ_KEY ReadKeyStroke;
  |     EFI_EVENT WaitForKey;
  | } EFI_SIMPLE_TEXT_INPUT_PROTOCOL;

To sum up, wait_for_event takes the number of events to wait for and a
pointer to an EFI_EVENT array of that size. Because we define efi_event
as void *, it went unnoticed that we passed a plain pointer instead of
a pointer to a pointer like the API expects.

With the using of an opaque type in the follow-up commit, this will
trigger a warning, so we fix this here in anticipation.

I am not sure how this went unnoticed so far, but the efi-stdio
console driver behaves as one would expect in Qemu.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/serial/efi-stdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index c8c84270093e..d31de5f53796 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -87,7 +87,7 @@ static int efi_read_key(struct efi_console_priv *priv, bool wait)
 
 	/* wait until key is pressed */
 	if (wait)
-		BS->wait_for_event(1, priv->in->wait_for_key, &index);
+		BS->wait_for_event(1, &priv->in->wait_for_key, &index);
 
 	if (priv->inex) {
 		efiret = priv->inex->read_key_stroke_ex(priv->inex, &kd);
-- 
2.39.2




More information about the barebox mailing list