Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / firmware / efi / efivars.c
index 70635b3b59d39d8751ceb4848d56ca962eb8f210..b623c599e572975fd30db879da54194ef025dcf7 100644 (file)
@@ -67,6 +67,8 @@
 
 #include <linux/efi.h>
 #include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/ucs2_string.h>
 
 #define EFIVARS_VERSION "0.08"
 #define EFIVARS_DATE "2004-May-17"
@@ -407,7 +409,7 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var)
        efi_char16_t *variable_name;
 
        variable_name = new_var->var.VariableName;
-       variable_name_size = utf16_strlen(variable_name) * sizeof(efi_char16_t);
+       variable_name_size = ucs2_strlen(variable_name) * sizeof(efi_char16_t);
 
        /*
         * Length of the variable bytes in ASCII, plus the '-' separator,
@@ -418,10 +420,8 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var)
 
        short_name = kzalloc(short_name_size, GFP_KERNEL);
 
-       if (!short_name) {
-               kfree(short_name);
+       if (!short_name)
                return 1;
-       }
 
        /* Convert Unicode to normal chars (assume top bits are 0),
           ala UTF-8 */