USB: Fix for typo in ohci-ep93xx.c
[powerpc.git] / drivers / firmware / efivars.c
index bda5bce..5ab5e39 100644 (file)
  *   v0.01 release to linux-ia64@linuxia64.org
  */
 
-#include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/init.h>
-#include <linux/sched.h>               /* for capable() */
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/string.h>
@@ -568,20 +567,20 @@ systab_read(struct subsystem *entry, char *buf)
        if (!entry || !buf)
                return -EINVAL;
 
-       if (efi.mps)
-               str += sprintf(str, "MPS=0x%lx\n", __pa(efi.mps));
-       if (efi.acpi20)
-               str += sprintf(str, "ACPI20=0x%lx\n", __pa(efi.acpi20));
-       if (efi.acpi)
-               str += sprintf(str, "ACPI=0x%lx\n", __pa(efi.acpi));
-       if (efi.smbios)
-               str += sprintf(str, "SMBIOS=0x%lx\n", __pa(efi.smbios));
-       if (efi.hcdp)
-               str += sprintf(str, "HCDP=0x%lx\n", __pa(efi.hcdp));
-       if (efi.boot_info)
-               str += sprintf(str, "BOOTINFO=0x%lx\n", __pa(efi.boot_info));
-       if (efi.uga)
-               str += sprintf(str, "UGA=0x%lx\n", __pa(efi.uga));
+       if (efi.mps != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "MPS=0x%lx\n", efi.mps);
+       if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "ACPI20=0x%lx\n", efi.acpi20);
+       if (efi.acpi != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "ACPI=0x%lx\n", efi.acpi);
+       if (efi.smbios != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
+       if (efi.hcdp != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp);
+       if (efi.boot_info != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "BOOTINFO=0x%lx\n", efi.boot_info);
+       if (efi.uga != EFI_INVALID_TABLE_ADDR)
+               str += sprintf(str, "UGA=0x%lx\n", efi.uga);
 
        return str - buf;
 }
@@ -640,7 +639,12 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
 
        kobject_set_name(&new_efivar->kobj, "%s", short_name);
        kobj_set_kset_s(new_efivar, vars_subsys);
-       kobject_register(&new_efivar->kobj);
+       i = kobject_register(&new_efivar->kobj);
+       if (i) {
+               kfree(short_name);
+               kfree(new_efivar);
+               return 1;
+       }
 
        kfree(short_name);
        short_name = NULL;