aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/amimouse.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/amimouse.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/amimouse.c')
-rw-r--r--drivers/input/mouse/amimouse.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c
index 599a7b2dc519..239a0e16d91a 100644
--- a/drivers/input/mouse/amimouse.c
+++ b/drivers/input/mouse/amimouse.c
@@ -95,10 +95,13 @@ static void amimouse_close(struct input_dev *dev)
95 95
96static int __init amimouse_init(void) 96static int __init amimouse_init(void)
97{ 97{
98 int err;
99
98 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE)) 100 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE))
99 return -ENODEV; 101 return -ENODEV;
100 102
101 if (!(amimouse_dev = input_allocate_device())) 103 amimouse_dev = input_allocate_device();
104 if (!amimouse_dev)
102 return -ENOMEM; 105 return -ENOMEM;
103 106
104 amimouse_dev->name = "Amiga mouse"; 107 amimouse_dev->name = "Amiga mouse";
@@ -114,7 +117,11 @@ static int __init amimouse_init(void)
114 amimouse_dev->open = amimouse_open; 117 amimouse_dev->open = amimouse_open;
115 amimouse_dev->close = amimouse_close; 118 amimouse_dev->close = amimouse_close;
116 119
117 input_register_device(amimouse_dev); 120 err = input_register_device(amimouse_dev);
121 if (err) {
122 input_free_device(amimouse_dev);
123 return err;
124 }
118 125
119 return 0; 126 return 0;
120} 127}