Input: h3600_ts - fix error handling at connect
In case of an error in h3600ts_connect(), deconstruct in correct order and with the right calls. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
parent
8f74c0661c
commit
908433833c
@ -399,31 +399,34 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
|
|||||||
IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) {
|
IRQF_SHARED | IRQF_DISABLED, "h3600_action", &ts->dev)) {
|
||||||
printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
|
printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
goto fail2;
|
goto fail1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
|
if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
|
||||||
IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) {
|
IRQF_SHARED | IRQF_DISABLED, "h3600_suspend", &ts->dev)) {
|
||||||
printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n");
|
printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n");
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
goto fail3;
|
goto fail2;
|
||||||
}
|
}
|
||||||
|
|
||||||
serio_set_drvdata(serio, ts);
|
serio_set_drvdata(serio, ts);
|
||||||
|
|
||||||
err = serio_open(serio, drv);
|
err = serio_open(serio, drv);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
goto fail3;
|
||||||
|
|
||||||
//h3600_flite_control(1, 25); /* default brightness */
|
//h3600_flite_control(1, 25); /* default brightness */
|
||||||
input_register_device(ts->dev);
|
err = input_register_device(ts->dev);
|
||||||
|
if (err)
|
||||||
|
goto fail4;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail3: free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev);
|
fail4: serio_close(serio);
|
||||||
|
fail3: serio_set_drvdata(serio, NULL);
|
||||||
|
free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev);
|
||||||
fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev);
|
fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev);
|
||||||
fail1: serio_set_drvdata(serio, NULL);
|
fail1: input_free_device(input_dev);
|
||||||
input_free_device(input_dev);
|
|
||||||
kfree(ts);
|
kfree(ts);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user