* [PATCH 0/5] serial: Remove redundant error messages on IRQ request failure
@ 2026-07-22 3:43 Pan Chuang
2026-07-22 3:43 ` [PATCH 2/5] serial: imx: Remove redundant dev_err() Pan Chuang
0 siblings, 1 reply; 3+ messages in thread
From: Pan Chuang @ 2026-07-22 3:43 UTC (permalink / raw)
To: Al Cooper, Broadcom internal kernel review list,
Greg Kroah-Hartman, Jiri Slaby, Frank Li, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Pali Rohár,
Orson Zhai, Baolin Wang, Chunyan Zhang, Sherry Sun, Pan Chuang,
Robin Gong, Cixi Geng, Wenhua Lin,
open list:BROADCOM BRCMSTB UART DRIVER,
open list:TTY LAYER AND SERIAL DRIVERS,
open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
Commit 55b48e23f5c4 ("genirq/devres: Add error handling in
devm_request_*_irq()") added automatic error logging to
devm_request_threaded_irq() and devm_request_any_context_irq()
via the new devm_request_result() helper, which prints device
name, IRQ number, handler functions, and error code on failure.
Since devm_request_irq() is a static inline wrapper around
devm_request_threaded_irq(), it also benefits from this
automatic logging.
Remove the now-redundant dev_err() and dev_err_probe() calls
in tty drivers that follow these devm_request_*_irq()
functions, as the core now provides more detailed diagnostic
information on failure.
Pan Chuang (5):
serial: 8250_bcm7271: Remove redundant dev_err_probe()
serial: imx: Remove redundant dev_err()
serial: mvebu-uart: Remove redundant dev_err()
serial: mctrl_gpio: Remove redundant dev_err()
serial: sprd: Remove redundant dev_err()
drivers/tty/serial/8250/8250_bcm7271.c | 4 +---
drivers/tty/serial/imx.c | 19 ++++---------------
drivers/tty/serial/mvebu-uart.c | 12 ++----------
drivers/tty/serial/serial_mctrl_gpio.c | 3 ---
drivers/tty/serial/sprd_serial.c | 5 +----
5 files changed, 8 insertions(+), 35 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/5] serial: imx: Remove redundant dev_err() 2026-07-22 3:43 [PATCH 0/5] serial: Remove redundant error messages on IRQ request failure Pan Chuang @ 2026-07-22 3:43 ` Pan Chuang 2026-07-22 3:57 ` sashiko-bot 0 siblings, 1 reply; 3+ messages in thread From: Pan Chuang @ 2026-07-22 3:43 UTC (permalink / raw) To: Greg Kroah-Hartman, Jiri Slaby, Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Sherry Sun, Robin Gong, Pan Chuang, open list:TTY LAYER AND SERIAL DRIVERS, open list:TTY LAYER AND SERIAL DRIVERS, open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE, moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()"), devm_request_irq() automatically logs detailed error messages on failure. Remove the now-redundant driver-specific dev_err() calls. Signed-off-by: Pan Chuang <panchuang@vivo.com> --- drivers/tty/serial/imx.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 251a50c8aa38..95fdb60e06a7 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2602,34 +2602,23 @@ static int imx_uart_probe(struct platform_device *pdev) if (txirq > 0) { ret = devm_request_irq(&pdev->dev, rxirq, imx_uart_rxint, 0, dev_name(&pdev->dev), sport); - if (ret) { - dev_err(&pdev->dev, "failed to request rx irq: %d\n", - ret); + if (ret) goto err_clk; - } ret = devm_request_irq(&pdev->dev, txirq, imx_uart_txint, 0, dev_name(&pdev->dev), sport); - if (ret) { - dev_err(&pdev->dev, "failed to request tx irq: %d\n", - ret); + if (ret) goto err_clk; - } ret = devm_request_irq(&pdev->dev, rtsirq, imx_uart_rtsint, 0, dev_name(&pdev->dev), sport); - if (ret) { - dev_err(&pdev->dev, "failed to request rts irq: %d\n", - ret); + if (ret) goto err_clk; - } } else { ret = devm_request_irq(&pdev->dev, rxirq, imx_uart_int, 0, dev_name(&pdev->dev), sport); - if (ret) { - dev_err(&pdev->dev, "failed to request irq: %d\n", ret); + if (ret) goto err_clk; - } } imx_uart_ports[sport->port.line] = sport; -- 2.34.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/5] serial: imx: Remove redundant dev_err() 2026-07-22 3:43 ` [PATCH 2/5] serial: imx: Remove redundant dev_err() Pan Chuang @ 2026-07-22 3:57 ` sashiko-bot 0 siblings, 0 replies; 3+ messages in thread From: sashiko-bot @ 2026-07-22 3:57 UTC (permalink / raw) To: Pan Chuang; +Cc: imx, Frank.Li Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: Pre-existing issues: - [High] The global `imx_uart_ports` array retains a dangling pointer to a freed `sport` structure if `uart_add_one_port()` fails or when the driver is unbound. - [High] The hrtimers `trigger_start_tx` and `trigger_stop_tx` are never synchronously cancelled during device teardown, leading to a potential Use-After-Free. -- --- Patch [2]: [PATCH 2/5] serial: imx: Remove redundant dev_err() --- commit 44174bba1c656c63bfedf3dc6b8ca0b3fa1165cb Author: Pan Chuang <panchuang@vivo.com> serial: imx: Remove redundant dev_err() This commit removes driver-specific dev_err() calls after devm_request_irq(), as the core function already logs detailed error messages on failure since commit 55b48e23f5c4. > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 251a50c8aa387..95fdb60e06a77 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -2602,34 +2602,23 @@ static int imx_uart_probe(struct platform_device *pdev) [ ... ] > } else { > ret = devm_request_irq(&pdev->dev, rxirq, imx_uart_int, 0, > dev_name(&pdev->dev), sport); > - if (ret) { > - dev_err(&pdev->dev, "failed to request irq: %d\n", ret); > + if (ret) > goto err_clk; > - } > } > > imx_uart_ports[sport->port.line] = sport; [Severity: High] This is a pre-existing issue, but does this leave a dangling pointer in the global array if uart_add_one_port() fails later in the probe function? If uart_add_one_port() fails, the function returns an error and devm automatically frees the sport structure. However, the pointer was already assigned to imx_uart_ports[sport->port.line] and is never cleared on the error path. Could this lead to a use-after-free if the console subsystem or sysrq accesses the array? Similarly, it looks like imx_uart_remove() does not clear this array entry before devres frees the memory during driver unbind. [Severity: High] This is also a pre-existing issue, but are the trigger_start_tx and trigger_stop_tx hrtimers synchronously cancelled during device teardown? Looking at the unbind path in imx_uart_remove(): static void imx_uart_remove(struct platform_device *pdev) { struct imx_port *sport = platform_get_drvdata(pdev); uart_remove_one_port(&imx_uart_uart_driver, &sport->port); } During unbind, imx_uart_shutdown() tries to stop the port and calls hrtimer_try_to_cancel() implicitly. However, hrtimer_try_to_cancel() doesn't wait for a currently executing callback to finish. Since explicit hrtimer_cancel() is never called in imx_uart_remove(), could devres free the sport structure while the hrtimer callback is still running or pending on another CPU, resulting in a use-after-free? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260722034342.316755-1-panchuang@vivo.com?part=2 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-22 3:57 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-07-22 3:43 [PATCH 0/5] serial: Remove redundant error messages on IRQ request failure Pan Chuang 2026-07-22 3:43 ` [PATCH 2/5] serial: imx: Remove redundant dev_err() Pan Chuang 2026-07-22 3:57 ` sashiko-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox