aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/rpcmouse.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:19 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:19 -0500
commit721556150e397f606a3f029736d77a27503f94e2 (patch)
tree1bdce32c4d1421f0dfbd9871986fcb7eaa6aba56 /drivers/input/mouse/rpcmouse.c
parent127278ce2254c61f1346500374d61e33f74a8729 (diff)
Input: mice - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/rpcmouse.c')
-rw-r--r--drivers/input/mouse/rpcmouse.c20
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)
66 66
67static int __init rpcmouse_init(void) 67static int __init rpcmouse_init(void)
68{ 68{
69 if (!(rpcmouse_dev = input_allocate_device())) 69 int err;
70
71 rpcmouse_dev = input_allocate_device();
72 if (!rpcmouse_dev)
70 return -ENOMEM; 73 return -ENOMEM;
71 74
72 rpcmouse_dev->name = "Acorn RiscPC Mouse"; 75 rpcmouse_dev->name = "Acorn RiscPC Mouse";
@@ -85,13 +88,22 @@ static int __init rpcmouse_init(void)
85 88
86 if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) { 89 if (request_irq(IRQ_VSYNCPULSE, rpcmouse_irq, IRQF_SHARED, "rpcmouse", rpcmouse_dev)) {
87 printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n"); 90 printk(KERN_ERR "rpcmouse: unable to allocate VSYNC interrupt\n");
88 input_free_device(rpcmouse_dev); 91 err = -EBUSY;
89 return -EBUSY; 92 goto err_free_dev;
90 } 93 }
91 94
92 input_register_device(rpcmouse_dev); 95 err = input_register_device(rpcmouse_dev);
96 if (err)
97 goto err_free_irq;
93 98
94 return 0; 99 return 0;
100
101 err_free_irq:
102 free_irq(IRQ_VSYNCPULSE, rpcmouse_dev);
103 err_free_dev:
104 input_free_device(rpcmouse_dev);
105
106 return err;
95} 107}
96 108
97static void __exit rpcmouse_exit(void) 109static void __exit rpcmouse_exit(void)