mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Costantino Leandro <lcostantino@gmail.com>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 3/5] Staging: panel: fix oops on panel_cleanup_module
Date: Fri, 27 Feb 2009 14:49:20 -0800	[thread overview]
Message-ID: <1235774963-19732-3-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <20090227224555.GB19545@kroah.com>

From: Costantino Leandro <lcostantino@gmail.com>

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>
---
 drivers/staging/panel/panel.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index ab69c1b..c2747bc 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);
 }
 
-- 
1.6.0.2


  parent reply	other threads:[~2009-02-27 22:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27 22:45 [GIT PATCH] STAGING patches for 2.6-git Greg KH
2009-02-27 22:49 ` [PATCH 1/5] Staging: rtl8187se: fix Kconfig dependencies Greg Kroah-Hartman
2009-02-27 22:49 ` [PATCH 2/5] Staging: rtl8187se: Fix oops and memory poison caused by builtin ieee80211 Greg Kroah-Hartman
2009-02-27 22:49 ` Greg Kroah-Hartman [this message]
2009-02-27 22:49 ` [PATCH 4/5] Staging: w35und: fix registration with wlan stack Greg Kroah-Hartman
2009-02-27 22:49 ` [PATCH 5/5] Staging: w35und: fix usb_control_msg() error handling in wb35_probe() Greg Kroah-Hartman

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=1235774963-19732-3-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=lcostantino@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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