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>
This commit is contained in:
parent
e5c6c8e457
commit
dd55563f63
|
@ -252,14 +252,14 @@ static struct pnp_driver ns558_pnp_driver;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int pnp_registered = 0;
|
|
||||||
|
|
||||||
static int __init ns558_init(void)
|
static int __init ns558_init(void)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int error;
|
||||||
|
|
||||||
if (pnp_register_driver(&ns558_pnp_driver) >= 0)
|
error = pnp_register_driver(&ns558_pnp_driver);
|
||||||
pnp_registered = 1;
|
if (error && error != -ENODEV) /* should be ENOSYS really */
|
||||||
|
return error;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Probe ISA ports after PnP, so that PnP ports that are already
|
* Probe ISA ports after PnP, so that PnP ports that are already
|
||||||
|
@ -270,7 +270,7 @@ static int __init ns558_init(void)
|
||||||
while (ns558_isa_portlist[i])
|
while (ns558_isa_portlist[i])
|
||||||
ns558_isa_probe(ns558_isa_portlist[i++]);
|
ns558_isa_probe(ns558_isa_portlist[i++]);
|
||||||
|
|
||||||
return (list_empty(&ns558_list) && !pnp_registered) ? -ENODEV : 0;
|
return list_empty(&ns558_list) && error ? -ENODEV : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit ns558_exit(void)
|
static void __exit ns558_exit(void)
|
||||||
|
@ -283,7 +283,6 @@ static void __exit ns558_exit(void)
|
||||||
kfree(ns558);
|
kfree(ns558);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pnp_registered)
|
|
||||||
pnp_unregister_driver(&ns558_pnp_driver);
|
pnp_unregister_driver(&ns558_pnp_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue