aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-03-14 00:12:08 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-03-14 00:12:08 -0500
commitdd55563f635751327eb06ae569d4761a0220f2e0 (patch)
treea87b2dca6e8eae4ca1f988a84f710a0181154ccd
parente5c6c8e457d16c7cbc12f849ad18d4d508950de2 (diff)
Input: ns558 - fix logic around pnp_register_driver()
Do not assume that pnp_register_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/gameport/ns558.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c
index d2e55dc956b..3e2d28f263e 100644
--- a/drivers/input/gameport/ns558.c
+++ b/drivers/input/gameport/ns558.c
@@ -252,14 +252,14 @@ static struct pnp_driver ns558_pnp_driver;
252 252
253#endif 253#endif
254 254
255static int pnp_registered = 0;
256
257static int __init ns558_init(void) 255static int __init ns558_init(void)
258{ 256{
259 int i = 0; 257 int i = 0;
258 int error;
260 259
261 if (pnp_register_driver(&ns558_pnp_driver) >= 0) 260 error = pnp_register_driver(&ns558_pnp_driver);
262 pnp_registered = 1; 261 if (error && error != -ENODEV) /* should be ENOSYS really */
262 return error;
263 263
264/* 264/*
265 * Probe ISA ports after PnP, so that PnP ports that are already 265 * Probe ISA ports after PnP, so that PnP ports that are already
@@ -270,7 +270,7 @@ static int __init ns558_init(void)
270 while (ns558_isa_portlist[i]) 270 while (ns558_isa_portlist[i])
271 ns558_isa_probe(ns558_isa_portlist[i++]); 271 ns558_isa_probe(ns558_isa_portlist[i++]);
272 272
273 return (list_empty(&ns558_list) && !pnp_registered) ? -ENODEV : 0; 273 return list_empty(&ns558_list) && error ? -ENODEV : 0;
274} 274}
275 275
276static void __exit ns558_exit(void) 276static void __exit ns558_exit(void)
@@ -283,8 +283,7 @@ static void __exit ns558_exit(void)
283 kfree(ns558); 283 kfree(ns558);
284 } 284 }
285 285
286 if (pnp_registered) 286 pnp_unregister_driver(&ns558_pnp_driver);
287 pnp_unregister_driver(&ns558_pnp_driver);
288} 287}
289 288
290module_init(ns558_init); 289module_init(ns558_init);