summaryrefslogtreecommitdiff
path: root/drivers/input/keyboard/locomokbd.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:39:56 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:39:56 -0500
commit2b03b60e6b8635fffdd15d5d24943950f2bbf96e (patch)
tree17f0354b7edb08920a89e663ef724c84518c49fa /drivers/input/keyboard/locomokbd.c
parent41ad5fbabda0c3930136bb40cfc7a0c23013365f (diff)
Input: keyboards - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/locomokbd.c')
-rw-r--r--drivers/input/keyboard/locomokbd.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 5788dbc317bb..2ade5186cc41 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -193,22 +193,22 @@ static int locomokbd_probe(struct locomo_dev *dev)
{
struct locomokbd *locomokbd;
struct input_dev *input_dev;
- int i, ret;
+ int i, err;
locomokbd = kzalloc(sizeof(struct locomokbd), GFP_KERNEL);
input_dev = input_allocate_device();
if (!locomokbd || !input_dev) {
- ret = -ENOMEM;
- goto free;
+ err = -ENOMEM;
+ goto err_free_mem;
}
/* try and claim memory region */
if (!request_mem_region((unsigned long) dev->mapbase,
dev->length,
LOCOMO_DRIVER_NAME(dev))) {
- ret = -EBUSY;
+ err = -EBUSY;
printk(KERN_ERR "locomokbd: Can't acquire access to io memory for keyboard\n");
- goto free;
+ goto err_free_mem;
}
locomokbd->ldev = dev;
@@ -244,24 +244,28 @@ static int locomokbd_probe(struct locomo_dev *dev)
clear_bit(0, input_dev->keybit);
/* attempt to get the interrupt */
- ret = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
- if (ret) {
+ err = request_irq(dev->irq[0], locomokbd_interrupt, 0, "locomokbd", locomokbd);
+ if (err) {
printk(KERN_ERR "locomokbd: Can't get irq for keyboard\n");
- goto out;
+ goto err_release_region;
}
- input_register_device(locomokbd->input);
+ err = input_register_device(locomokbd->input);
+ if (err)
+ goto err_free_irq;
return 0;
-out:
+ err_free_irq:
+ free_irq(dev->irq[0], locomokbd);
+ err_release_region:
release_mem_region((unsigned long) dev->mapbase, dev->length);
locomo_set_drvdata(dev, NULL);
-free:
+ err_free_mem:
input_free_device(input_dev);
kfree(locomokbd);
- return ret;
+ return err;
}
static int locomokbd_remove(struct locomo_dev *dev)