The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH] thinkpad acpi module_exit fix
  2007-08-08 16:43 [PATCH] thinkpad acpi module_exit fix Dave Young
@ 2007-08-08  9:48 ` Thomas Renninger
  2007-08-08 12:16 ` Henrique de Moraes Holschuh
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Renninger @ 2007-08-08  9:48 UTC (permalink / raw)
  To: Dave Young; +Cc: hmh, linux-acpi, Linux Kernel Mailing List

On Wed, 2007-08-08 at 16:43 +0000, Dave Young wrote:
> Hi,
> 
> [This fix is not very good for the global variable, any comments are
> welcome.]
> 
> The thinkpad_acpi module_init fail out entrace is not very properly. if
> failing before register driver or before create sysfs file, the
> module_exit will try to remove nonexist sysfs files, the kernel will
> oops.
This one is already fixed in Len's git tree in the test branch and will
get merged to Linus soon (commit id:
ac36393de6034be7266264a435360e7628849005).

The (similar) patch got posted on linux-acpi with subject:
[PATCH 05/12] ACPI: thinkpad-acpi: fix the module init failure path
(Fri,  3 Aug 2007 18:33:38)

    Thomas


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] thinkpad acpi module_exit fix
  2007-08-08 16:43 [PATCH] thinkpad acpi module_exit fix Dave Young
  2007-08-08  9:48 ` Thomas Renninger
@ 2007-08-08 12:16 ` Henrique de Moraes Holschuh
  1 sibling, 0 replies; 3+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-08-08 12:16 UTC (permalink / raw)
  To: Dave Young; +Cc: linux-acpi, Linux Kernel Mailing List

On Wed, 08 Aug 2007, Dave Young wrote:
> [This fix is not very good for the global variable, any comments are
> welcome.]
> 
> The thinkpad_acpi module_init fail out entrace is not very properly. if
> failing before register driver or before create sysfs file, the
> module_exit will try to remove nonexist sysfs files, the kernel will
> oops.
> 
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

NAK, this is already fixed in Len's tree.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] thinkpad acpi module_exit fix
@ 2007-08-08 16:43 Dave Young
  2007-08-08  9:48 ` Thomas Renninger
  2007-08-08 12:16 ` Henrique de Moraes Holschuh
  0 siblings, 2 replies; 3+ messages in thread
From: Dave Young @ 2007-08-08 16:43 UTC (permalink / raw)
  To: hmh; +Cc: linux-acpi, Linux Kernel Mailing List

Hi,

[This fix is not very good for the global variable, any comments are
welcome.]

The thinkpad_acpi module_init fail out entrace is not very properly. if
failing before register driver or before create sysfs file, the
module_exit will try to remove nonexist sysfs files, the kernel will
oops.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

---
drivers/misc/thinkpad_acpi.c |   19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff -upr linux/drivers/misc/thinkpad_acpi.c linux.new/drivers/misc/thinkpad_acpi.c
--- linux/drivers/misc/thinkpad_acpi.c	2007-08-08 16:28:19.000000000 +0000
+++ linux.new/drivers/misc/thinkpad_acpi.c	2007-08-08 16:35:11.000000000 +0000
@@ -91,6 +91,8 @@ MODULE_LICENSE("GPL");
 
 /* Please remove this in year 2009 */
 MODULE_ALIAS("ibm_acpi");
+static int sysfs_ret = 1;
+static int driver_ret = 1;
 
 /*
  * DMI matching for module autoloading
@@ -4662,14 +4664,14 @@ static int __init thinkpad_acpi_module_i
 	}
 	proc_dir->owner = THIS_MODULE;
 
-	ret = platform_driver_register(&tpacpi_pdriver);
-	if (ret) {
+	driver_ret = platform_driver_register(&tpacpi_pdriver);
+	if (driver_ret) {
 		printk(IBM_ERR "unable to register platform driver\n");
 		thinkpad_acpi_module_exit();
 		return ret;
 	}
-	ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
-	if (ret) {
+	sysfs_ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
+	if (sysfs_ret) {
 		printk(IBM_ERR "unable to create sysfs driver attributes\n");
 		thinkpad_acpi_module_exit();
 		return ret;
@@ -4756,8 +4758,13 @@ static void thinkpad_acpi_module_exit(vo
 	if (tpacpi_pdev)
 		platform_device_unregister(tpacpi_pdev);
 
-	tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
-	platform_driver_unregister(&tpacpi_pdriver);
+	if(!sysfs_ret){
+		tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
+	}
+
+	if(!driver_ret){
+		platform_driver_unregister(&tpacpi_pdriver);
+	}
 
 	if (proc_dir)
 		remove_proc_entry(IBM_PROC_DIR, acpi_root_dir);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-08 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 16:43 [PATCH] thinkpad acpi module_exit fix Dave Young
2007-08-08  9:48 ` Thomas Renninger
2007-08-08 12:16 ` Henrique de Moraes Holschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox