|
|
2aacef |
From 1dc423e2c194eec07a04b666533cd39e74eab6de Mon Sep 17 00:00:00 2001
|
|
|
2aacef |
From: Jan Janssen <medhefgo@web.de>
|
|
|
2aacef |
Date: Sat, 12 Nov 2022 16:24:53 +0100
|
|
|
2aacef |
Subject: [PATCH] boot: Silence driver reconnect errors
|
|
|
2aacef |
|
|
|
2aacef |
(cherry picked from commit 98ac5192d5feddae19f6f5ceb60aa3751a30676b)
|
|
|
2aacef |
|
|
|
2aacef |
Related: #2138081
|
|
|
2aacef |
---
|
|
|
2aacef |
src/boot/efi/drivers.c | 28 +++++++++++++---------------
|
|
|
2aacef |
1 file changed, 13 insertions(+), 15 deletions(-)
|
|
|
2aacef |
|
|
|
2aacef |
diff --git a/src/boot/efi/drivers.c b/src/boot/efi/drivers.c
|
|
|
2aacef |
index 39b65e74a6..7f2057f5a1 100644
|
|
|
2aacef |
--- a/src/boot/efi/drivers.c
|
|
|
2aacef |
+++ b/src/boot/efi/drivers.c
|
|
|
2aacef |
@@ -51,25 +51,23 @@ static EFI_STATUS load_one_driver(
|
|
|
2aacef |
}
|
|
|
2aacef |
|
|
|
2aacef |
EFI_STATUS reconnect_all_drivers(void) {
|
|
|
2aacef |
- _cleanup_free_ EFI_HANDLE *handles = NULL;
|
|
|
2aacef |
- UINTN n_handles = 0;
|
|
|
2aacef |
- EFI_STATUS err;
|
|
|
2aacef |
+ _cleanup_free_ EFI_HANDLE *handles = NULL;
|
|
|
2aacef |
+ size_t n_handles = 0;
|
|
|
2aacef |
+ EFI_STATUS err;
|
|
|
2aacef |
|
|
|
2aacef |
- /* Reconnects all handles, so that any loaded drivers can take effect. */
|
|
|
2aacef |
+ /* Reconnects all handles, so that any loaded drivers can take effect. */
|
|
|
2aacef |
|
|
|
2aacef |
- err = BS->LocateHandleBuffer(AllHandles, NULL, NULL, &n_handles, &handles);
|
|
|
2aacef |
- if (err != EFI_SUCCESS)
|
|
|
2aacef |
- return log_error_status_stall(err, L"Failed to get list of handles: %r", err);
|
|
|
2aacef |
+ err = BS->LocateHandleBuffer(AllHandles, NULL, NULL, &n_handles, &handles);
|
|
|
2aacef |
+ if (err != EFI_SUCCESS)
|
|
|
2aacef |
+ return log_error_status_stall(err, L"Failed to get list of handles: %r", err);
|
|
|
2aacef |
|
|
|
2aacef |
- for (UINTN i = 0; i < n_handles; i++) {
|
|
|
2aacef |
- err = BS->ConnectController(handles[i], NULL, NULL, true);
|
|
|
2aacef |
- if (err == EFI_NOT_FOUND) /* No drivers for this handle */
|
|
|
2aacef |
- continue;
|
|
|
2aacef |
- if (err != EFI_SUCCESS)
|
|
|
2aacef |
- log_error_status_stall(err, L"Failed to reconnect handle %" PRIuN L", ignoring: %r", i, err);
|
|
|
2aacef |
- }
|
|
|
2aacef |
+ for (size_t i = 0; i < n_handles; i++)
|
|
|
2aacef |
+ /* Some firmware gives us some bogus handles (or they might become bad due to
|
|
|
2aacef |
+ * reconnecting everything). Security policy may also prevent us from doing so too.
|
|
|
2aacef |
+ * There is nothing we can realistically do on errors anyways, so just ignore them. */
|
|
|
2aacef |
+ (void) BS->ConnectController(handles[i], NULL, NULL, true);
|
|
|
2aacef |
|
|
|
2aacef |
- return EFI_SUCCESS;
|
|
|
2aacef |
+ return EFI_SUCCESS;
|
|
|
2aacef |
}
|
|
|
2aacef |
|
|
|
2aacef |
EFI_STATUS load_drivers(
|