]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: invert if check, to reduce indentation level
authorLennart Poettering <lennart@poettering.net>
Thu, 16 Sep 2021 14:02:36 +0000 (16:02 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 20 Sep 2021 20:17:49 +0000 (22:17 +0200)
src/boot/efi/boot.c

index af02cfb7e91a65d2e75e8334e3dd11d52f436eec..cfe20c27f809eff81d8f72f8dec6c512ea73c49e 100644 (file)
@@ -1501,35 +1501,37 @@ static VOID config_load_entries(
         assert(loaded_image_path);
 
         err = uefi_call_wrapper(root_dir->Open, 5, root_dir, &entries_dir, (CHAR16*) L"\\loader\\entries", EFI_FILE_MODE_READ, 0ULL);
-        if (!EFI_ERROR(err)) {
-                for (;;) {
-                        CHAR16 buf[256];
-                        UINTN bufsize;
-                        EFI_FILE_INFO *f;
-                        _cleanup_freepool_ CHAR8 *content = NULL;
-
-                        bufsize = sizeof(buf);
-                        err = uefi_call_wrapper(entries_dir->Read, 3, entries_dir, &bufsize, buf);
-                        if (bufsize == 0 || EFI_ERROR(err))
-                                break;
+        if (EFI_ERROR(err))
+                return;
 
-                        f = (EFI_FILE_INFO *) buf;
-                        if (f->FileName[0] == '.')
-                                continue;
-                        if (f->Attribute & EFI_FILE_DIRECTORY)
-                                continue;
+        for (;;) {
+                CHAR16 buf[256];
+                UINTN bufsize;
+                EFI_FILE_INFO *f;
+                _cleanup_freepool_ CHAR8 *content = NULL;
 
-                        if (!endswith_no_case(f->FileName, L".conf"))
-                                continue;
-                        if (startswith(f->FileName, L"auto-"))
-                                continue;
+                bufsize = sizeof(buf);
+                err = uefi_call_wrapper(entries_dir->Read, 3, entries_dir, &bufsize, buf);
+                if (bufsize == 0 || EFI_ERROR(err))
+                        break;
 
-                        err = file_read(entries_dir, f->FileName, 0, 0, &content, NULL);
-                        if (!EFI_ERROR(err))
-                                config_entry_add_from_file(config, device, root_dir, L"\\loader\\entries", f->FileName, content, loaded_image_path);
-                }
-                uefi_call_wrapper(entries_dir->Close, 1, entries_dir);
+                f = (EFI_FILE_INFO *) buf;
+                if (f->FileName[0] == '.')
+                        continue;
+                if (f->Attribute & EFI_FILE_DIRECTORY)
+                        continue;
+
+                if (!endswith_no_case(f->FileName, L".conf"))
+                        continue;
+                if (startswith(f->FileName, L"auto-"))
+                        continue;
+
+                err = file_read(entries_dir, f->FileName, 0, 0, &content, NULL);
+                if (!EFI_ERROR(err))
+                        config_entry_add_from_file(config, device, root_dir, L"\\loader\\entries", f->FileName, content, loaded_image_path);
         }
+
+        uefi_call_wrapper(entries_dir->Close, 1, entries_dir);
 }
 
 static INTN config_entry_compare(ConfigEntry *a, ConfigEntry *b) {