Skip to content

Commit 0b0595b

Browse files
PeterHuewegregkh
authored andcommitted
Staging: Panel: prevent driver from calling misc_deregister twice on same ressource
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 [raspberrypi#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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 9fcfeab commit 0b0595b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎drivers/staging/panel/panel.c‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,11 +2071,15 @@ static void panel_detach(struct parport *port)
20712071
return;
20722072
}
20732073

2074-
if (keypad_enabled && keypad_initialized)
2074+
if (keypad_enabled && keypad_initialized) {
20752075
misc_deregister(&keypad_dev);
2076+
keypad_initialized = 0;
2077+
}
20762078

2077-
if (lcd_enabled && lcd_initialized)
2079+
if (lcd_enabled && lcd_initialized) {
20782080
misc_deregister(&lcd_dev);
2081+
lcd_initialized = 0;
2082+
}
20792083

20802084
parport_release(pprt);
20812085
parport_unregister_device(pprt);
@@ -2211,13 +2215,16 @@ static void __exit panel_cleanup_module(void)
22112215
del_timer(&scan_timer);
22122216

22132217
if (pprt != NULL) {
2214-
if (keypad_enabled)
2218+
if (keypad_enabled) {
22152219
misc_deregister(&keypad_dev);
2220+
keypad_initialized = 0;
2221+
}
22162222

22172223
if (lcd_enabled) {
22182224
panel_lcd_print("\x0cLCD driver " PANEL_VERSION
22192225
"\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-");
22202226
misc_deregister(&lcd_dev);
2227+
lcd_initialized = 0;
22212228
}
22222229

22232230
/* TODO: free all input signals */

0 commit comments

Comments
 (0)