mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Huewe <PeterHuewe@gmx.de>
To: "Greg Kroah-Hartman" <gregkh@suse.de>
Cc: Willy Tarreau <w@1wt.eu>,
	Sudhakar Rajashekhara <sudhakar.raj@ti.com>,
	Costantino Leandro <lcostantino@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging/panel: prevent driver from calling misc_deregister twice on same ressource
Date: Tue, 29 Sep 2009 01:22:40 +0200	[thread overview]
Message-ID: <200909290122.40485.PeterHuewe@gmx.de> (raw)

From: Peter Huewe <peterhuewe@gmx.de>

This patch prevents the driver from calling misc_deregister twice on the same
ressouce when unloading the driver.
Unloading the driver without this patch results in a Kernel BUG like this:
Panel driver version 0.9.5 registered on parport0 (io=0x378).
BUG: unable to handle kernel paging request at 0000000000100108
IP: [<ffffffff803c02ee>] misc_deregister+0x2d/0x90
PGD 6caff067 PUD 762b7067 PMD 0
Oops: 0002 [#1] PREEMPT SMP
last sysfs file: /sys/devices/platform/w83627hf.656/in8_input
...

This patch fixes this issue, although maybe not in the best way possible :)

linux version v2.6.32-rc1 - linus git tree, Di 29. Sep 01:10:18 CEST 2009

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
old mode 100644
new mode 100755
index dd7d3fd..4ce399b
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2071,11 +2071,15 @@ static void panel_detach(struct parport *port)
 		return;
 	}
 
-	if (keypad_enabled && keypad_initialized)
+	if (keypad_enabled && keypad_initialized) {
 		misc_deregister(&keypad_dev);
+		keypad_initialized = 0;
+	}
 
-	if (lcd_enabled && lcd_initialized)
+	if (lcd_enabled && lcd_initialized) {
 		misc_deregister(&lcd_dev);
+		lcd_initialized = 0;
+	}
 
 	parport_release(pprt);
 	parport_unregister_device(pprt);
@@ -2211,13 +2215,16 @@ static void __exit panel_cleanup_module(void)
 		del_timer(&scan_timer);
 
 	if (pprt != NULL) {
-		if (keypad_enabled)
+		if (keypad_enabled) {
 			misc_deregister(&keypad_dev);
+			keypad_initialized = 0;
+		}
 
 		if (lcd_enabled) {
 			panel_lcd_print("\x0cLCD driver " PANEL_VERSION
 					"\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-");
 			misc_deregister(&lcd_dev);
+			lcd_initialized = 0;
 		}
 
 		/* TODO: free all input signals */

                 reply	other threads:[~2009-09-28 23:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909290122.40485.PeterHuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=lcostantino@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudhakar.raj@ti.com \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome