]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: minor clean-ups in initrd_unregister()
authorLennart Poettering <lennart@amutable.com>
Tue, 7 Apr 2026 20:25:24 +0000 (22:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 18 Apr 2026 07:48:42 +0000 (09:48 +0200)
src/boot/initrd.c

index 569b757be7a2333e5e9ab0001d62b1a5591e250d..4babe1671d557e41e73687b47a8e12c449b0043a 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "efi-log.h"
-#include "efi.h"
 #include "initrd.h"
 #include "iovec-util-fundamental.h"
 #include "proto/device-path.h"
@@ -112,16 +111,16 @@ EFI_STATUS initrd_register(
 }
 
 EFI_STATUS initrd_unregister(EFI_HANDLE initrd_handle) {
-        EFI_STATUS err;
         struct initrd_loader *loader;
+        EFI_STATUS err;
 
         if (!initrd_handle)
                 return EFI_SUCCESS;
 
-        /* get the LoadFile2 protocol that we allocated earlier */
+        /* Get the LoadFile2 protocol that we allocated earlier */
         err = BS->HandleProtocol(initrd_handle, MAKE_GUID_PTR(EFI_LOAD_FILE2_PROTOCOL), (void **) &loader);
         if (err != EFI_SUCCESS)
-                return err;
+                return log_debug_status(err, "Failed to acquire LoadFile2 protocol on our own initrd handle: %m");
 
         /* uninstall all protocols thus destroying the handle */
         err = BS->UninstallMultipleProtocolInterfaces(
@@ -130,9 +129,8 @@ EFI_STATUS initrd_unregister(EFI_HANDLE initrd_handle) {
                         loader,
                         NULL);
         if (err != EFI_SUCCESS)
-                return err;
+                return log_debug_status(err, "Failed to uninstall LoadFile2 protocol from our own initrd handle: %m");
 
-        initrd_handle = NULL;
         free(loader);
         return EFI_SUCCESS;
 }