From 9879a192224fea214b77a37a98a049b45851cb42 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Apr 2026 22:25:24 +0200 Subject: [PATCH] boot: minor clean-ups in initrd_unregister() --- src/boot/initrd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/boot/initrd.c b/src/boot/initrd.c index 569b757be7..4babe1671d 100644 --- a/src/boot/initrd.c +++ b/src/boot/initrd.c @@ -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; }