mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.1 01/34] serial: stm32: Ignore return value of uart_remove_one_port() in .remove()
@ 2023-07-24  1:32 Sasha Levin
  2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 02/34] led: qcom-lpg: Fix resource leaks in for_each_available_child_of_node() loops Sasha Levin
                   ` (32 more replies)
  0 siblings, 33 replies; 34+ messages in thread
From: Sasha Levin @ 2023-07-24  1:32 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Uwe Kleine-König, Greg Kroah-Hartman, Sasha Levin, jslaby,
	mcoquelin.stm32, alexandre.torgue, linux-serial,
	linux-arm-kernel

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

[ 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>
---
 drivers/tty/serial/stm32-usart.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 28edbaf7bb329..2a9c4058824a8 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -1753,13 +1753,10 @@ static int stm32_usart_serial_remove(struct platform_device *pdev)
 	struct uart_port *port = platform_get_drvdata(pdev);
 	struct stm32_port *stm32_port = to_stm32_port(port);
 	const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
-	int err;
 	u32 cr3;
 
 	pm_runtime_get_sync(&pdev->dev);
-	err = uart_remove_one_port(&stm32_usart_driver, port);
-	if (err)
-		return(err);
+	uart_remove_one_port(&stm32_usart_driver, port);
 
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
-- 
2.39.2


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2023-07-24  2:04 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24  1:32 [PATCH AUTOSEL 6.1 01/34] serial: stm32: Ignore return value of uart_remove_one_port() in .remove() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 02/34] led: qcom-lpg: Fix resource leaks in for_each_available_child_of_node() loops Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 03/34] media: v4l2-mem2mem: add lock to protect parameter num_rdy Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 04/34] media: camss: set VFE bpl_alignment to 16 for sdm845 and sm8250 Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 05/34] usb: gadget: u_serial: Avoid spinlock recursion in __gs_console_push Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 06/34] usb: gadget: uvc: queue empty isoc requests if no video buffer is available Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 07/34] media: platform: mediatek: vpu: fix NULL ptr dereference Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 08/34] thunderbolt: Read retimer NVM authentication status prior tb_retimer_set_inbound_sbtx() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 09/34] xhci: Don't require a valid get_quirks() function pointer during xhci setup Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 10/34] usb: chipidea: imx: don't request QoS for imx8ulp Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 11/34] usb: cdns2: Device side header file for CDNS2 driver Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 12/34] usb: chipidea: imx: add missing USB PHY DPDM wakeup setting Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 13/34] gfs2: Fix possible data races in gfs2_show_options() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 14/34] pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 15/34] thunderbolt: Add Intel Barlow Ridge PCI ID Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 16/34] thunderbolt: Limit Intel Barlow Ridge USB3 bandwidth Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 17/34] firewire: net: fix use after free in fwnet_finish_incoming_packet() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 18/34] watchdog: sp5100_tco: support Hygon FCH/SCH (Server Controller Hub) Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 19/34] Bluetooth: L2CAP: Fix use-after-free Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 20/34] Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 21/34] Bluetooth: btusb: Add MT7922 bluetooth ID for the Asus Ally Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 22/34] ceph: try to dump the msgs when decoding fails Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 23/34] drm/amdgpu: Fix potential fence use-after-free v2 Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 24/34] f2fs: fix to do sanity check on direct node in truncate_dnode() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 25/34] fs/ntfs3: Enhance sanity check while generating attr_list Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 26/34] fs: ntfs3: Fix possible null-pointer dereferences in mi_read() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 27/34] fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_load_attr_list() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 28/34] fs/ntfs3: Mark ntfs dirty when on-disk struct is corrupted Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 29/34] ALSA: hda/realtek: Add quirks for Unis H3C Desktop B760 & Q760 Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 30/34] ALSA: hda: fix a possible null-pointer dereference due to data race in snd_hdac_regmap_sync() Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 31/34] ALSA: hda/realtek: Add quirk for ASUS ROG GX650P Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 32/34] ALSA: hda/realtek: Add quirk for ASUS ROG GA402X Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 33/34] apparmor: fix use of strcpy in policy_unpack_test Sasha Levin
2023-07-24  1:32 ` [PATCH AUTOSEL 6.1 34/34] ALSA: hda/realtek: Add quirk for ASUS ROG GZ301V Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®