efivarfs: Drop 'duplicates' bool parameter on efivar_init()
authorArd Biesheuvel <ardb@kernel.org>
Sat, 24 Feb 2024 17:48:14 +0000 (18:48 +0100)
committerArd Biesheuvel <ardb@kernel.org>
Sun, 25 Feb 2024 08:43:39 +0000 (09:43 +0100)
The 'duplicates' bool argument is always true when efivar_init() is
called from its only caller so let's just drop it instead.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
fs/efivarfs/internal.h
fs/efivarfs/super.c
fs/efivarfs/vars.c

index 169252e6dc4616c7712126adde4a36ce8e2d6922..f7206158ee81385eeaab387fd16b05aea5a7634b 100644 (file)
@@ -38,7 +38,7 @@ struct efivar_entry {
 
 int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *,
                            struct list_head *),
-               void *data, bool duplicates, struct list_head *head);
+               void *data, struct list_head *head);
 
 int efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
 void __efivar_entry_add(struct efivar_entry *entry, struct list_head *head);
index 210daac79748fe06a4d930157835c5fb75d675f1..bb14462f6d992a5506f4fda2158952cb410c96f3 100644 (file)
@@ -343,7 +343,7 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)
        if (err)
                return err;
 
-       return efivar_init(efivarfs_callback, sb, true, &sfi->efivarfs_list);
+       return efivar_init(efivarfs_callback, sb, &sfi->efivarfs_list);
 }
 
 static int efivarfs_get_tree(struct fs_context *fc)
index 2ad377818d0f30544a220c5705518c073f5dddd7..4d722af1014f2a18198cc3e831d1fea68d46e251 100644 (file)
@@ -361,7 +361,6 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
  * efivar_init - build the initial list of EFI variables
  * @func: callback function to invoke for every variable
  * @data: function-specific data to pass to @func
- * @duplicates: error if we encounter duplicates on @head?
  * @head: initialised head of variable list
  *
  * Get every EFI variable from the firmware and invoke @func. @func
@@ -371,7 +370,7 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
  */
 int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *,
                            struct list_head *),
-               void *data, bool duplicates, struct list_head *head)
+               void *data, struct list_head *head)
 {
        unsigned long variable_name_size = 512;
        efi_char16_t *variable_name;
@@ -414,8 +413,7 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *,
                         * we'll ever see a different variable name,
                         * and may end up looping here forever.
                         */
-                       if (duplicates &&
-                           variable_is_present(variable_name, &vendor_guid,
+                       if (variable_is_present(variable_name, &vendor_guid,
                                                head)) {
                                dup_variable_bug(variable_name, &vendor_guid,
                                                 variable_name_size);