aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/mk712.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:03 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:03 -0500
commit52c1f5704d7555a16641429b2e7af5d26d7b119a (patch)
treeeb55cec7167646ba18f09d7d4b0009712fe45062 /drivers/input/touchscreen/mk712.c
parentInput: keyboards - handle errors when registering input devices (diff)
downloadlinux-dev-52c1f5704d7555a16641429b2e7af5d26d7b119a.tar.xz
linux-dev-52c1f5704d7555a16641429b2e7af5d26d7b119a.zip
Input: touchscreens - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/mk712.c')
-rw-r--r--drivers/input/touchscreen/mk712.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/mk712.c b/drivers/input/touchscreen/mk712.c
index 4cbcaa6a71e5..44140feeffc5 100644
--- a/drivers/input/touchscreen/mk712.c
+++ b/drivers/input/touchscreen/mk712.c
@@ -96,15 +96,13 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id)
goto end;
}
- if (~status & MK712_STATUS_TOUCH)
- {
+ if (~status & MK712_STATUS_TOUCH) {
debounce = 1;
input_report_key(mk712_dev, BTN_TOUCH, 0);
goto end;
}
- if (debounce)
- {
+ if (debounce) {
debounce = 0;
goto end;
}
@@ -113,8 +111,7 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id)
input_report_abs(mk712_dev, ABS_X, last_x);
input_report_abs(mk712_dev, ABS_Y, last_y);
-end:
-
+ end:
last_x = inw(mk712_io + MK712_X) & 0x0fff;
last_y = inw(mk712_io + MK712_Y) & 0x0fff;
input_sync(mk712_dev);
@@ -169,13 +166,14 @@ static int __init mk712_init(void)
(inw(mk712_io + MK712_STATUS) & 0xf333)) {
printk(KERN_WARNING "mk712: device not present\n");
err = -ENODEV;
- goto fail;
+ goto fail1;
}
- if (!(mk712_dev = input_allocate_device())) {
+ mk712_dev = input_allocate_device();
+ if (!mk712_dev) {
printk(KERN_ERR "mk712: not enough memory\n");
err = -ENOMEM;
- goto fail;
+ goto fail1;
}
mk712_dev->name = "ICS MicroClock MK712 TouchScreen";
@@ -196,13 +194,17 @@ static int __init mk712_init(void)
if (request_irq(mk712_irq, mk712_interrupt, 0, "mk712", mk712_dev)) {
printk(KERN_WARNING "mk712: unable to get IRQ\n");
err = -EBUSY;
- goto fail;
+ goto fail1;
}
- input_register_device(mk712_dev);
+ err = input_register_device(mk712_dev);
+ if (err)
+ goto fail2;
+
return 0;
- fail: input_free_device(mk712_dev);
+ fail2: free_irq(mk712_irq, mk712_dev);
+ fail1: input_free_device(mk712_dev);
release_region(mk712_io, 8);
return err;
}