]> git.hungrycats.org Git - linux/commitdiff
[PATCH] efivars: check that it's enabled
authorAndrew Morton <akpm@osdl.org>
Sat, 15 May 2004 03:19:52 +0000 (20:19 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 15 May 2004 03:19:52 +0000 (20:19 -0700)
From: "Randy.Dunlap" <rddunlap@osdl.org>

EFI-enabled kernels crash on non-EFI machines.  efivars_init() and
efivars_exit() need to check efi_enabled instead of assuming that the
system is using EFI.

arch/i386/kernel/setup.c
drivers/firmware/efivars.c

index 938ec130f920a17f7861b87d8a431be7f694b826..76f34d0822d9271ef691d9a7980cb5508902fc13 100644 (file)
@@ -65,6 +65,7 @@ static inline char * __init machine_specific_memory_setup(void);
 
 #ifdef CONFIG_EFI
 int efi_enabled = 0;
+EXPORT_SYMBOL(efi_enabled);
 #endif
 
 /* cpu data as detected by the assembly code in head.S */
index ddaf82f868c8c6bb463c738e63081e2290060b0c..192fb6a2e1e53fbdfda25f75da4a34e46b108156 100644 (file)
@@ -664,6 +664,9 @@ efivars_init(void)
        unsigned long variable_name_size = 1024;
        int i, rc = 0, error = 0;
 
+       if (!efi_enabled)
+               return -ENODEV;
+
        printk(KERN_INFO "EFI Variables Facility v%s\n", EFIVARS_VERSION);
 
        /*
@@ -733,6 +736,9 @@ efivars_exit(void)
 {
        struct list_head *pos, *n;
 
+       if (!efi_enabled)
+               return;
+
        list_for_each_safe(pos, n, &efivar_list)
                efivar_unregister(get_efivar_entry(pos));