]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: avoid #ifdef in efi_setup.c
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 16 Oct 2024 10:17:39 +0000 (12:17 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 18 Oct 2024 14:17:29 +0000 (16:17 +0200)
We prefer `if` over `#ifdef` in our code.

Eliminate #ifdef statements in efi_setup.c.

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_setup.c

index a610e032d2fa584df4f6cdcdb0ebb8ff3d7ab8aa..aa59bc7779dfb165f06de737173db4c19778f66d 100644 (file)
@@ -86,7 +86,6 @@ out:
        return ret;
 }
 
-#ifdef CONFIG_EFI_SECURE_BOOT
 /**
  * efi_init_secure_boot - initialize secure boot state
  *
@@ -112,12 +111,6 @@ static efi_status_t efi_init_secure_boot(void)
 
        return ret;
 }
-#else
-static efi_status_t efi_init_secure_boot(void)
-{
-       return EFI_SUCCESS;
-}
-#endif /* CONFIG_EFI_SECURE_BOOT */
 
 /**
  * efi_init_capsule - initialize capsule update state
@@ -302,9 +295,11 @@ efi_status_t efi_init_obj_list(void)
        }
 
        /* Secure boot */
-       ret = efi_init_secure_boot();
-       if (ret != EFI_SUCCESS)
-               goto out;
+       if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) {
+               ret = efi_init_secure_boot();
+               if (ret != EFI_SUCCESS)
+                       goto out;
+       }
 
        /* Indicate supported runtime services */
        ret = efi_init_runtime_supported();
@@ -322,11 +317,11 @@ efi_status_t efi_init_obj_list(void)
                if (ret != EFI_SUCCESS)
                        goto out;
        }
-#ifdef CONFIG_NETDEVICES
-       ret = efi_net_register();
-       if (ret != EFI_SUCCESS)
-               goto out;
-#endif
+       if (IS_ENABLED(CONFIG_NETDEVICES)) {
+               ret = efi_net_register();
+               if (ret != EFI_SUCCESS)
+                       goto out;
+       }
        if (IS_ENABLED(CONFIG_ACPI)) {
                ret = efi_acpi_register();
                if (ret != EFI_SUCCESS)