diff options
Diffstat (limited to 'drivers/input/keyboard/corgikbd.c')
-rw-r--r-- | drivers/input/keyboard/corgikbd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index befdd6006b50..1016c94e65db 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c @@ -291,15 +291,12 @@ static int __init corgikbd_probe(struct platform_device *pdev) { struct corgikbd *corgikbd; struct input_dev *input_dev; - int i; + int i, err = -ENOMEM; corgikbd = kzalloc(sizeof(struct corgikbd), GFP_KERNEL); input_dev = input_allocate_device(); - if (!corgikbd || !input_dev) { - kfree(corgikbd); - input_free_device(input_dev); - return -ENOMEM; - } + if (!corgikbd || !input_dev) + goto fail; platform_set_drvdata(pdev, corgikbd); @@ -341,7 +338,9 @@ static int __init corgikbd_probe(struct platform_device *pdev) set_bit(SW_TABLET_MODE, input_dev->swbit); set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); - input_register_device(corgikbd->input); + err = input_register_device(corgikbd->input); + if (err) + goto fail; mod_timer(&corgikbd->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL)); @@ -362,6 +361,10 @@ static int __init corgikbd_probe(struct platform_device *pdev) pxa_gpio_mode(CORGI_GPIO_AK_INT | GPIO_IN); return 0; + + fail: input_free_device(input_dev); + kfree(corgikbd); + return err; } static int corgikbd_remove(struct platform_device *pdev) |