From f10bb2544bab75b3e8df15a7b51a833c78cbd77f Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Tue, 19 Dec 2006 12:56:09 -0800 Subject: ACPI: fix single linked list manipulation Fix single linked list manipulation for sub_driver. If the remving entry is not on the head of the sub_driver list, it goes into infinate loop. Though that infinite loop doesn't happen. Because the only user of acpi_pci_register_dirver() is acpiphp. Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/pci_root.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 0984a1e..c92c144 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -98,11 +98,12 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) struct acpi_pci_driver **pptr = &sub_driver; while (*pptr) { - if (*pptr != driver) - continue; - *pptr = (*pptr)->next; - break; + if (*pptr == driver) + break; + pptr = &(*pptr)->next; } + BUG_ON(!*pptr); + *pptr = (*pptr)->next; if (!driver->remove) return; -- cgit v1.1 From 83822fc9e6ad2e0f3799174f7c6ad3aa285b9488 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Tue, 19 Dec 2006 12:56:10 -0800 Subject: ACPI: prevent processor module from loading on failures Make loading processor.ko fail when an error happens. Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/processor_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 1908e0d2..22eb05e 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -901,13 +901,13 @@ static int __init acpi_processor_init(void) acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir); if (!acpi_processor_dir) - return 0; + return -ENOMEM; acpi_processor_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&acpi_processor_driver); if (result < 0) { remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); - return 0; + return result; } acpi_processor_install_hotplug_notify(); -- cgit v1.1 From a6fdbf90b94fa4e2f5f7cbb526c71160b6c561c8 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 19 Dec 2006 12:56:13 -0800 Subject: ACPI: fix NULL check in drivers/acpi/osl.c Spotted by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/osl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c84286c..e10679c 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1032,7 +1032,7 @@ acpi_status acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) { *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); - if (cache == NULL) + if (*cache == NULL) return AE_ERROR; else return AE_OK; -- cgit v1.1 From 6796a1204cfeac6dab1c2dd682d1138454eca661 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 19 Dec 2006 12:56:13 -0800 Subject: ACPI: Kconfig - depend on PM rather than selecting it Make ACPI depend on PM rather than selecting it. Otherwise it's a nightmare working out why CONFIG_PM keeps getting set. Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 0f9d4be..6382f64 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -11,7 +11,7 @@ config ACPI bool "ACPI Support" depends on IA64 || X86 depends on PCI - select PM + depends on PM default y ---help--- Advanced Configuration and Power Interface (ACPI) support for -- cgit v1.1