public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: matthieu castet <castet.matthieu@free.fr>
To: Linux Kernel list <linux-kernel@vger.kernel.org>,
	Vojtech Pavlik <vojtech@suse.cz>, Adam Belay <ambx1@neo.rr.com>
Subject: [patch] ns558 bug
Date: Fri, 04 Feb 2005 21:00:54 +0100	[thread overview]
Message-ID: <4203D476.4040706@free.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

Hi,

this patch is based on http://bugzilla.kernel.org/show_bug.cgi?id=2962 
patch from adam belay.

It solve a oops when pnp_register_driver(&ns558_pnp_driver) failed.

Please apply this patch.

Matthieu

[-- Attachment #2: ns558.patch --]
[-- Type: text/x-patch, Size: 1015 bytes --]

Index: drivers/input/gameport/ns558.c
===================================================================
RCS file: /home/mat/dev/linux-cvs-rep/linux-cvs/drivers/input/gameport/ns558.c,v
retrieving revision 1.15
diff -u -u -r1.15 ns558.c
--- drivers/input/gameport/ns558.c	16 Sep 2004 14:04:04 -0000	1.15
+++ drivers/input/gameport/ns558.c	4 Feb 2005 19:53:20 -0000
@@ -261,6 +261,8 @@
 
 #endif
 
+static int registered = 0;
+
 int __init ns558_init(void)
 {
 	int i = 0;
@@ -272,8 +274,10 @@
 	while (ns558_isa_portlist[i])
 		ns558_isa_probe(ns558_isa_portlist[i++]);
 
-	pnp_register_driver(&ns558_pnp_driver);
-	return list_empty(&ns558_list) ? -ENODEV : 0;
+	if (pnp_register_driver(&ns558_pnp_driver) >= 0) 
+		registered = 1;
+
+	return (list_empty(&ns558_list) && !registered) ? -ENODEV : 0;
 }
 
 void __exit ns558_exit(void)
@@ -297,7 +301,8 @@
 				break;
 		}
 	}
-	pnp_unregister_driver(&ns558_pnp_driver);
+	if (registered)
+		pnp_unregister_driver(&ns558_pnp_driver);
 }
 
 module_init(ns558_init);

             reply	other threads:[~2005-02-04 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-04 20:00 matthieu castet [this message]
2005-02-05  0:43 ` [patch] ns558 bug Adam Belay
2005-02-05  3:06   ` Andrew Morton
2005-02-05  3:08     ` Adam Belay
2005-02-05  3:21       ` Andrew Morton
2005-02-05  3:48         ` Adam Belay
2005-02-05  4:01           ` Andrew Morton
2005-02-05  8:31     ` matthieu castet
2005-02-07  9:53 ` Vojtech Pavlik

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=4203D476.4040706@free.fr \
    --to=castet.matthieu@free.fr \
    --cc=ambx1@neo.rr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /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