diff options
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 1cf32a7814d0..7b4056292eaf 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -855,10 +855,16 @@ static void atkbd_disconnect(struct serio *serio) | |||
855 | 855 | ||
856 | atkbd_disable(atkbd); | 856 | atkbd_disable(atkbd); |
857 | 857 | ||
858 | /* make sure we don't have a command in flight */ | 858 | input_unregister_device(atkbd->dev); |
859 | |||
860 | /* | ||
861 | * Make sure we don't have a command in flight. | ||
862 | * Note that since atkbd->enabled is false event work will keep | ||
863 | * rescheduling itself until it gets canceled and will not try | ||
864 | * accessing freed input device or serio port. | ||
865 | */ | ||
859 | cancel_delayed_work_sync(&atkbd->event_work); | 866 | cancel_delayed_work_sync(&atkbd->event_work); |
860 | 867 | ||
861 | input_unregister_device(atkbd->dev); | ||
862 | serio_close(serio); | 868 | serio_close(serio); |
863 | serio_set_drvdata(serio, NULL); | 869 | serio_set_drvdata(serio, NULL); |
864 | kfree(atkbd); | 870 | kfree(atkbd); |