Skip to contentSkip to conversation

apm-power.c: Fix crash when unloading modules

PATCH Applied Helge Deller 2 participants 2 messages Mar 24, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apm-power.c: Fix crash when unloading modules

This patch fixes a crash in the apm-power driver when a input-device (e.g. a keyboard driver module) is unloaded.
Fix is the same as it's used in the evbug driver.
I assume this patch went unnoticed, since most keyboard drivers in PDAs are not compiled as modules.

CC Richard Purdie <[email protected]>

--

 apm-power.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

--

drivers/input/apm-power.c +2 -5
index c36d110..7d61a96 100644
@@ -63,8 +63,6 @@ static int apmpower_connect(struct input_handler *handler,
 	handle->handler = handler;
 	handle->name = "apm-power";
 
-	handler->private = handle;
-
 	error = input_register_handle(handle);
 	if (error) {
 		printk(KERN_ERR
@@ -87,11 +85,10 @@ static int apmpower_connect(struct input_handler *handler,
 	return 0;
 }
 
-static void apmpower_disconnect(struct input_handle *handler)
+static void apmpower_disconnect(struct input_handle *handle)
 {
-	struct input_handle *handle = handler->private;
-
 	input_close_device(handle);
+	input_unregister_handle(handle);
 	kfree(handle);
 }
 
maintainer Applied
#1 lore raw
Quoted 9 lines · Helge Deller

This patch fixes a crash in the apm-power driver when a input-device (e.g. a keyboard driver module) is unloaded.
Fix is the same as it's used in the evbug driver.
I assume this patch went unnoticed, since most keyboard drivers in PDAs are not compiled as modules.

CC Richard Purdie <[email protected]>

Applied to the "for-linus" branch of my tree, thank you Helge.

Signature · 1 line
Dmitry