1
0
mirror of https://github.com/m42uko/linux-fsia6b.git synced 2022-05-12 18:36:03 +02:00

Fix error handling

This commit is contained in:
Markus Koch 2019-05-01 14:34:12 +02:00
parent dcc9841d93
commit a701882fd5

View File

@ -197,7 +197,8 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
(switch_config[i] > '3')) { (switch_config[i] > '3')) {
dev_err(&fsia6b->dev->dev, dev_err(&fsia6b->dev->dev,
"Invalid switch configuration supplied for fsia6b.\n"); "Invalid switch configuration supplied for fsia6b.\n");
return -EINVAL; err = -EINVAL;
goto fail3;
} }
for (j = '1'; j <= switch_config[i]; ++j) { for (j = '1'; j <= switch_config[i]; ++j) {
@ -209,10 +210,11 @@ static int fsia6b_serio_connect(struct serio *serio, struct serio_driver *drv)
err = input_register_device(fsia6b->dev); err = input_register_device(fsia6b->dev);
if (err) if (err)
goto fail2; goto fail3;
return 0; return 0;
fail3: input_free_device(input_dev);
fail2: serio_close(serio); fail2: serio_close(serio);
fail1: serio_set_drvdata(serio, NULL); fail1: serio_set_drvdata(serio, NULL);
kfree(fsia6b); kfree(fsia6b);