Input: twl4030_keypad - fix error handling path

We should not try to call free_irq() when request_irq() failed.

Reported-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
Dmitry Torokhov 2010-09-29 18:36:00 -07:00
parent 6792cbbb25
commit a9cc020222
1 changed files with 3 additions and 4 deletions

View File

@ -406,23 +406,22 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev)
if (error) { if (error) {
dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n", dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
kp->irq); kp->irq);
goto err3; goto err2;
} }
/* Enable KP and TO interrupts now. */ /* Enable KP and TO interrupts now. */
reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO); reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) { if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
error = -EIO; error = -EIO;
goto err4; goto err3;
} }
platform_set_drvdata(pdev, kp); platform_set_drvdata(pdev, kp);
return 0; return 0;
err4: err3:
/* mask all events - we don't care about the result */ /* mask all events - we don't care about the result */
(void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1); (void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
err3:
free_irq(kp->irq, NULL); free_irq(kp->irq, NULL);
err2: err2:
input_unregister_device(input); input_unregister_device(input);