Skip to content

Commit

Permalink
Input: i8042 - fix leaking of platform device on module removal
Browse files Browse the repository at this point in the history
Avoid resetting the module-wide i8042_platform_device pointer in
i8042_probe() or i8042_remove(), so that the device can be properly
destroyed by i8042_exit() on module unload.

Fixes: 9222ba6 ("Input: i8042 - add deferred probe support")
Signed-off-by: Chen Jun <chenjun102@huawei.com>
Link: https://lore.kernel.org/r/20221109034148.23821-1-chenjun102@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Chen Jun authored and Dmitry Torokhov committed Nov 18, 2022
1 parent 26c263b commit 81cd7e8
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/input/serio/i8042.c
Original file line number Diff line number Diff line change
Expand Up @@ -1543,8 +1543,6 @@ static int i8042_probe(struct platform_device *dev)
{
int error;

i8042_platform_device = dev;

if (i8042_reset == I8042_RESET_ALWAYS) {
error = i8042_controller_selftest();
if (error)
Expand Down Expand Up @@ -1582,7 +1580,6 @@ static int i8042_probe(struct platform_device *dev)
i8042_free_aux_ports(); /* in case KBD failed but AUX not */
i8042_free_irqs();
i8042_controller_reset(false);
i8042_platform_device = NULL;

return error;
}
Expand All @@ -1592,7 +1589,6 @@ static int i8042_remove(struct platform_device *dev)
i8042_unregister_ports();
i8042_free_irqs();
i8042_controller_reset(false);
i8042_platform_device = NULL;

return 0;
}
Expand Down

0 comments on commit 81cd7e8

Please sign in to comment.