Patch "serial: stm32: Ignore return value of uart_remove_one_port() in .remove()" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: stm32: Ignore return value of uart_remove_one_port() in .remove()

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-stm32-ignore-return-value-of-uart_remove_one_.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5ecfef76f0ffab029edea0a3fea8ab80c189fc75
Author: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
Date:   Fri May 12 19:38:09 2023 +0200

    serial: stm32: Ignore return value of uart_remove_one_port() in .remove()
    
    [ 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@xxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230512173810.131447-2-u.kleine-koenig@xxxxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 1e38fc9b10c11..e9e11a2596211 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -1755,13 +1755,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);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux