if pnp_register_protocol() fails, call put_device() to drop the device reference.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li lihaoxiang@isrc.iscas.ac.cn --- drivers/pnp/isapnp/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 219f96f2aaaf..d6daab7ed59e 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c @@ -983,8 +983,10 @@ static int __init isapnp_init(void) return -EBUSY; }
- if (pnp_register_protocol(&isapnp_protocol) < 0) + if (pnp_register_protocol(&isapnp_protocol) < 0) { + put_device(&isapnp_protocol.dev); return -EBUSY; + }
/* * Print a message. The existing ISAPnP code is hanging machines