diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:39:56 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:39:56 -0500 |
commit | 2b03b60e6b8635fffdd15d5d24943950f2bbf96e (patch) | |
tree | 17f0354b7edb08920a89e663ef724c84518c49fa /drivers/input/keyboard/amikbd.c | |
parent | 41ad5fbabda0c3930136bb40cfc7a0c23013365f (diff) |
Input: keyboards - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/amikbd.c')
-rw-r--r-- | drivers/input/keyboard/amikbd.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c index 8abdbd0ee8f9..16583d71753b 100644 --- a/drivers/input/keyboard/amikbd.c +++ b/drivers/input/keyboard/amikbd.c | |||
@@ -190,7 +190,7 @@ static int __init amikbd_init(void) | |||
190 | int i, j; | 190 | int i, j; |
191 | 191 | ||
192 | if (!AMIGAHW_PRESENT(AMI_KEYBOARD)) | 192 | if (!AMIGAHW_PRESENT(AMI_KEYBOARD)) |
193 | return -EIO; | 193 | return -ENODEV; |
194 | 194 | ||
195 | if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb")) | 195 | if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb")) |
196 | return -EBUSY; | 196 | return -EBUSY; |
@@ -198,8 +198,8 @@ static int __init amikbd_init(void) | |||
198 | amikbd_dev = input_allocate_device(); | 198 | amikbd_dev = input_allocate_device(); |
199 | if (!amikbd_dev) { | 199 | if (!amikbd_dev) { |
200 | printk(KERN_ERR "amikbd: not enough memory for input device\n"); | 200 | printk(KERN_ERR "amikbd: not enough memory for input device\n"); |
201 | release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100); | 201 | err = -ENOMEM; |
202 | return -ENOMEM; | 202 | goto fail1; |
203 | } | 203 | } |
204 | 204 | ||
205 | amikbd_dev->name = "Amiga Keyboard"; | 205 | amikbd_dev->name = "Amiga Keyboard"; |
@@ -231,10 +231,22 @@ static int __init amikbd_init(void) | |||
231 | memcpy(key_maps[i], temp_map, sizeof(temp_map)); | 231 | memcpy(key_maps[i], temp_map, sizeof(temp_map)); |
232 | } | 232 | } |
233 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ | 233 | ciaa.cra &= ~0x41; /* serial data in, turn off TA */ |
234 | request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", amikbd_interrupt); | 234 | if (request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", |
235 | amikbd_interrupt)) { | ||
236 | err = -EBUSY; | ||
237 | goto fail2; | ||
238 | } | ||
239 | |||
240 | err = input_register_device(amikbd_dev); | ||
241 | if (err) | ||
242 | goto fail3; | ||
235 | 243 | ||
236 | input_register_device(amikbd_dev); | ||
237 | return 0; | 244 | return 0; |
245 | |||
246 | fail3: free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt); | ||
247 | fail2: input_free_device(amikbd_dev); | ||
248 | fail1: release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100); | ||
249 | return err; | ||
238 | } | 250 | } |
239 | 251 | ||
240 | static void __exit amikbd_exit(void) | 252 | static void __exit amikbd_exit(void) |