diff options
Diffstat (limited to 'drivers/input/mouse/rpcmouse.c')
-rw-r--r-- | drivers/input/mouse/rpcmouse.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c index ea0468569610..fbdcfd8eb4e9 100644 --- a/drivers/input/mouse/rpcmouse.c +++ b/drivers/input/mouse/rpcmouse.c @@ -66,7 +66,10 @@ static irqreturn_t rpcmouse_irq(int irq, void *dev_id) static int __init rpcmouse_init(void) { - if (!(rpcmouse_dev = input_allocate_device())) + int err; + + rpcmouse_dev = input_allocate_device(); + if (!rpcmouse_dev) return -ENOMEM; rpcmouse_dev->name = "Acorn RiscPC Mouse"; @@ -85,13 +88,22 @@ static int __init rpcmouse_init(void) if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) { printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); - input_free_device(rpcmouse_dev); - return -EBUSY; + err = -EBUSY; + goto err_free_dev; } - input_register_device(rpcmouse_dev); + err = input_register_device(rpcmouse_dev); + if (err) + goto err_free_irq; return 0; + + err_free_irq: + free_irq(IRQ_VSYNCPULSE, rpcmouse_dev); + err_free_dev: + input_free_device(rpcmouse_dev); + + return err; } static void __exit rpcmouse_exit(void) |