ACPI: thinkpad-acpi: fix the module init failure path
commit8a7bf486623f797869a868ede1b04e44336bb1ee
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Fri, 27 Jul 2007 22:23:42 +0000 (27 19:23 -0300)
committerHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Sun, 23 Sep 2007 12:31:04 +0000 (23 09:31 -0300)
treefbd29798e1e924ff0affaf41dc05073366176682
parent2a18c2b676b243ebba6102af3ea7aecd2754839b
ACPI: thinkpad-acpi: fix the module init failure path

Thomas Renninger reports that if one tries to load thinkpad-acpi in a
non-thinkpad, one gets:

Call Trace:
 [<ffffffff802fa57d>] kref_get+0x2f/0x36
 [<ffffffff802f97f7>] kobject_get+0x12/0x17
 [<ffffffff8036dfd7>] get_driver+0x14/0x1a
 [<ffffffff8036dfee>] driver_remove_file+0x11/0x32
 [<ffffffff8823b9be>] :thinkpad_acpi:thinkpad_acpi_module_exit+0xa8/0xfc
 [<ffffffff8824b8a0>] :thinkpad_acpi:thinkpad_acpi_module_init+0x74a/0x776
 [<ffffffff8024f968>] __link_module+0x0/0x25
 [<ffffffff80252269>] sys_init_module+0x162c/0x178f
 [<ffffffff8020bc2e>] system_call+0x7e/0x83

So, track if the platform driver and its driver attributes were registered,
and only deallocate them in that case.

This patch is based on Thomas Renninger's patch for the issue.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Thomas Renninger <trenn@suse.de>
drivers/misc/thinkpad_acpi.c
drivers/misc/thinkpad_acpi.h