Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-drm-fsl-dcu.git] / drivers / platform / x86 / wmi.c
index f23d5a84e7b1b61108bdb651b5a240bed3ee4ed0..a134c26870b0d048929fc9eb6fe07e1e7172e35c 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/list.h>
 #include <linux/acpi.h>
 #include <linux/slab.h>
+#include <linux/module.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 
@@ -754,9 +755,13 @@ static void wmi_free_devices(void)
        struct wmi_block *wblock, *next;
 
        /* Delete devices for all the GUIDs */
-       list_for_each_entry_safe(wblock, next, &wmi_block_list, list)
+       list_for_each_entry_safe(wblock, next, &wmi_block_list, list) {
+               list_del(&wblock->list);
                if (wblock->dev.class)
                        device_unregister(&wblock->dev);
+               else
+                       kfree(wblock);
+       }
 }
 
 static bool guid_already_parsed(const char *guid_string)