]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
serial: stm32: Ignore return value of uart_remove_one_port() in .remove()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 12 May 2023 17:38:09 +0000 (19:38 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:12 +0000 (12:00 +0100)
commitf2a988c1c89f3f0059ceb6ca691543f9c20ccb8a
treee96fa9e6f2248dfd9a6cec77c306ffa7f3d96c86
parentf9de8a6486dd5779fb336c6edf01a46ba56666b0
serial: stm32: Ignore return value of uart_remove_one_port() in .remove()

BugLink: https://bugs.launchpad.net/bugs/2039110
[ Upstream commit 6bd6cd29c92401a101993290051fa55078238a52 ]

Returning early from stm32_usart_serial_remove() results in a resource
leak as several cleanup functions are not called. The driver core ignores
the return value and there is no possibility to clean up later.

uart_remove_one_port() only returns non-zero if there is some
inconsistency (i.e. stm32_usart_driver.state[port->line].uart_port == NULL).
This should never happen, and even if it does it's a bad idea to exit
early in the remove callback without cleaning up.

This prepares changing the prototype of struct platform_driver::remove to
return void. See commit 5c5a7680e67b ("platform: Provide a remove callback
that returns no value") for further details about this quest.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230512173810.131447-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/tty/serial/stm32-usart.c