summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-04-12 12:11:03 +0400
committerSascha Hauer <s.hauer@pengutronix.de>2014-04-23 14:01:45 +0200
commit1fc66d14018577194a6c0c517d7a636a2a2f5067 (patch)
treec8dec5154a35e07235dcd7fbfb72b44d97687640 /drivers/input
parent54a8d12cd294546fcc953a50535279c2b687cbc1 (diff)
downloadbarebox-1fc66d14018577194a6c0c517d7a636a2a2f5067.tar.gz
barebox-1fc66d14018577194a6c0c517d7a636a2a2f5067.tar.xz
imx_keypad: Fix error handling
Also remove the unnecessary check for xzalloc failure. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/imx_keypad.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/input/imx_keypad.c b/drivers/input/imx_keypad.c
index e6870dfcc2..afe93c3127 100644
--- a/drivers/input/imx_keypad.c
+++ b/drivers/input/imx_keypad.c
@@ -392,17 +392,13 @@ static int __init imx_keypad_probe(struct device_d *dev)
struct console_device *cdev;
int error, i;
- keypad = xzalloc(sizeof(struct imx_keypad));
- if (!keypad) {
- pr_err("not enough memory for driver data\n");
- error = -ENOMEM;
- }
-
if (!keymap_data) {
pr_err("no keymap defined\n");
return -ENODEV;
}
+ keypad = xzalloc(sizeof(struct imx_keypad));
+
keypad->dev = dev;
keypad->mmio_base = dev_request_mem_region(dev, 0);
@@ -420,8 +416,8 @@ static int __init imx_keypad_probe(struct device_d *dev)
if (keypad->rows_en_mask > ((1 << MAX_MATRIX_KEY_ROWS) - 1) ||
keypad->cols_en_mask > ((1 << MAX_MATRIX_KEY_COLS) - 1)) {
pr_err("invalid key data (too many rows or colums)\n");
- error = -EINVAL;
- //goto failed_clock_put;
+ free(keypad);
+ return -EINVAL;
}
pr_debug("enabled rows mask: %x\n", keypad->rows_en_mask);
pr_debug("enabled cols mask: %x\n", keypad->cols_en_mask);
@@ -446,7 +442,6 @@ static int __init imx_keypad_probe(struct device_d *dev)
console_register(&keypad->cdev);
return poller_register(&keypad->poller);
-
}
static struct driver_d imx_keypad_driver = {