Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f348b60 authored by Chen Jun's avatar Chen Jun Committed by Greg Kroah-Hartman
Browse files

Input: i8042 - fix leaking of platform device on module removal



[ Upstream commit 81cd7e8489278d28794e7b272950c3e00c344e44 ]

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: 9222ba68c3f4 ("Input: i8042 - add deferred probe support")
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Link: https://lore.kernel.org/r/20221109034148.23821-1-chenjun102@huawei.com


Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7b0007b2
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1540,8 +1540,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)
@@ -1579,7 +1577,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;
}
@@ -1589,7 +1586,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;
}