[PATCH 0/2] serial: Make uart_remove_one_port() return void

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri May 12 10:38:08 PDT 2023


Hello,

this is part of a quest to make struct platform_driver::remove return
void. But this series can be considered a cleanup on its own.

The motivation to make the remove callback of platform drivers return
void is that returning an int make driver authors (wrongly) assume there
is some kind of error handling in the core and it's a good idea to
return an error code. In reality a returned error code is ignored which
yields to leaked resources and in some cases also use-after-free
situations because for example the device isn't disabled and so later an
irq might trigger while the register mapping is already gone.

Best regards
Uwe

Uwe Kleine-König (2):
  serial: stm32: Ignore return value of uart_remove_one_port() in
    .remove()
  serial: Make uart_remove_one_port() return void

 drivers/tty/serial/atmel_serial.c           |  5 ++---
 drivers/tty/serial/clps711x.c               |  4 +++-
 drivers/tty/serial/cpm_uart/cpm_uart_core.c |  5 ++++-
 drivers/tty/serial/imx.c                    |  4 +++-
 drivers/tty/serial/lantiq.c                 |  4 +++-
 drivers/tty/serial/serial_core.c            |  6 +-----
 drivers/tty/serial/st-asc.c                 |  4 +++-
 drivers/tty/serial/stm32-usart.c            |  5 +----
 drivers/tty/serial/uartlite.c               | 12 ++++--------
 drivers/tty/serial/xilinx_uartps.c          |  5 ++---
 include/linux/serial_core.h                 |  2 +-
 11 files changed, 27 insertions(+), 29 deletions(-)


base-commit: ac9a78681b921877518763ba0e89202254349d1b
-- 
2.39.2




More information about the linux-arm-kernel mailing list