summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCostantino Leandro <lcostantino@gmail.com>2009-02-17 11:10:48 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-27 12:56:24 -0800
commit5789813e73220a0bfd85a44bc565a6ae624e8745 (patch)
tree4bc51fe5175409815b8f3788070cf8ce0e8cd8d0
parent096c55d1de39c0de526dfeb8a68ba3b0200e5a93 (diff)
downloadlinux-5789813e73220a0bfd85a44bc565a6ae624e8745.tar.bz2
Staging: panel: fix oops on panel_cleanup_module
Check for null pardevice (not registered, ej: panel never attached, inexistent parport, etc. ) before calling parport_release, parport_unregister_device, and related funcs on module release. Signed-off-by: Costantino Leandro <lcostantino@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/panel/panel.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index ab69c1bf36a8..c2747bc88c6f 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2164,19 +2164,20 @@ static void __exit panel_cleanup_module(void)
if (scan_timer.function != NULL)
del_timer(&scan_timer);
- if (keypad_enabled)
- misc_deregister(&keypad_dev);
+ if (pprt != NULL) {
+ if (keypad_enabled)
+ misc_deregister(&keypad_dev);
+
+ if (lcd_enabled) {
+ panel_lcd_print("\x0cLCD driver " PANEL_VERSION
+ "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-");
+ misc_deregister(&lcd_dev);
+ }
- if (lcd_enabled) {
- panel_lcd_print("\x0cLCD driver " PANEL_VERSION
- "\nunloaded.\x1b[Lc\x1b[Lb\x1b[L-");
- misc_deregister(&lcd_dev);
+ /* TODO: free all input signals */
+ parport_release(pprt);
+ parport_unregister_device(pprt);
}
-
- /* TODO: free all input signals */
-
- parport_release(pprt);
- parport_unregister_device(pprt);
parport_unregister_driver(&panel_driver);
}