All of lore.kernel.org
 help / color / mirror / Atom feed
* [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 1/5] serial: 8250_bcm7271: Remove redundant dev_err_probe() Pan Chuang
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ 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] 7+ messages in thread

* [PATCH 1/5] serial: 8250_bcm7271: Remove redundant dev_err_probe()
  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:43 ` [PATCH 2/5] serial: imx: Remove redundant dev_err() Pan Chuang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ 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,
	open list:BROADCOM BRCMSTB UART DRIVER,
	open list:TTY LAYER AND SERIAL DRIVERS
  Cc: Pan Chuang

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_probe() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/tty/serial/8250/8250_bcm7271.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index 742004d63c6f..cb7d594d263e 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -1099,10 +1099,8 @@ static int brcmuart_probe(struct platform_device *pdev)
 		}
 		ret = devm_request_irq(dev, dma_irq, brcmuart_isr,
 				IRQF_SHARED, "uart DMA irq", &new_port->port);
-		if (ret) {
-			dev_err_probe(dev, ret, "unable to register IRQ handler\n");
+		if (ret)
 			goto err1;
-		}
 	}
 	platform_set_drvdata(pdev, priv);
 	brcmuart_init_debugfs(priv, dev_name(&pdev->dev));
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ 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 ` [PATCH 1/5] serial: 8250_bcm7271: Remove redundant dev_err_probe() Pan Chuang
@ 2026-07-22  3:43 ` Pan Chuang
  2026-07-22  3:57   ` sashiko-bot
  2026-07-22  3:43 ` [PATCH 3/5] serial: mvebu-uart: " Pan Chuang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ 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] 7+ messages in thread

* [PATCH 3/5] serial: mvebu-uart: 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 ` [PATCH 1/5] serial: 8250_bcm7271: Remove redundant dev_err_probe() Pan Chuang
  2026-07-22  3:43 ` [PATCH 2/5] serial: imx: Remove redundant dev_err() Pan Chuang
@ 2026-07-22  3:43 ` Pan Chuang
  2026-07-22  3:43 ` [PATCH 4/5] serial: mctrl_gpio: " Pan Chuang
  2026-07-22  3:43 ` [PATCH 5/5] serial: sprd: " Pan Chuang
  4 siblings, 0 replies; 7+ messages in thread
From: Pan Chuang @ 2026-07-22  3:43 UTC (permalink / raw)
  To: Pali Rohár, Greg Kroah-Hartman, Jiri Slaby,
	open list:TTY LAYER AND SERIAL DRIVERS,
	open list:TTY LAYER AND SERIAL DRIVERS
  Cc: Pan Chuang

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/mvebu-uart.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index 8e52be2b34ea..33ea496c93b2 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -404,29 +404,21 @@ static int mvebu_uart_startup(struct uart_port *port)
 		ret = devm_request_irq(port->dev, mvuart->irq[UART_IRQ_SUM],
 				       mvebu_uart_isr, port->irqflags,
 				       dev_name(port->dev), port);
-		if (ret) {
-			dev_err(port->dev, "unable to request IRQ %d\n",
-				mvuart->irq[UART_IRQ_SUM]);
+		if (ret)
 			return ret;
-		}
 	} else {
 		/* New bindings with an IRQ for RX and TX (both UART) */
 		ret = devm_request_irq(port->dev, mvuart->irq[UART_RX_IRQ],
 				       mvebu_uart_rx_isr, port->irqflags,
 				       dev_name(port->dev), port);
-		if (ret) {
-			dev_err(port->dev, "unable to request IRQ %d\n",
-				mvuart->irq[UART_RX_IRQ]);
+		if (ret)
 			return ret;
-		}
 
 		ret = devm_request_irq(port->dev, mvuart->irq[UART_TX_IRQ],
 				       mvebu_uart_tx_isr, port->irqflags,
 				       dev_name(port->dev),
 				       port);
 		if (ret) {
-			dev_err(port->dev, "unable to request IRQ %d\n",
-				mvuart->irq[UART_TX_IRQ]);
 			devm_free_irq(port->dev, mvuart->irq[UART_RX_IRQ],
 				      port);
 			return ret;
-- 
2.34.1


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

* [PATCH 4/5] serial: mctrl_gpio: Remove redundant dev_err()
  2026-07-22  3:43 [PATCH 0/5] serial: Remove redundant error messages on IRQ request failure Pan Chuang
                   ` (2 preceding siblings ...)
  2026-07-22  3:43 ` [PATCH 3/5] serial: mvebu-uart: " Pan Chuang
@ 2026-07-22  3:43 ` Pan Chuang
  2026-07-22  3:43 ` [PATCH 5/5] serial: sprd: " Pan Chuang
  4 siblings, 0 replies; 7+ messages in thread
From: Pan Chuang @ 2026-07-22  3:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Pan Chuang,
	open list:TTY LAYER AND SERIAL DRIVERS,
	open list:TTY LAYER AND SERIAL DRIVERS

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() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/tty/serial/serial_mctrl_gpio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c
index 7b02c5ca4afd..dff13a9f2614 100644
--- a/drivers/tty/serial/serial_mctrl_gpio.c
+++ b/drivers/tty/serial/serial_mctrl_gpio.c
@@ -256,9 +256,6 @@ struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx)
 				       gpios);
 		if (ret) {
 			/* alternatively implement polling */
-			dev_err(port->dev,
-				"failed to request irq for %s (idx=%d, err=%d)\n",
-				mctrl_gpios_desc[i].name, idx, ret);
 			return ERR_PTR(ret);
 		}
 	}
-- 
2.34.1


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

* [PATCH 5/5] serial: sprd: Remove redundant dev_err()
  2026-07-22  3:43 [PATCH 0/5] serial: Remove redundant error messages on IRQ request failure Pan Chuang
                   ` (3 preceding siblings ...)
  2026-07-22  3:43 ` [PATCH 4/5] serial: mctrl_gpio: " Pan Chuang
@ 2026-07-22  3:43 ` Pan Chuang
  4 siblings, 0 replies; 7+ messages in thread
From: Pan Chuang @ 2026-07-22  3:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Pan Chuang, Cixi Geng, Wenhua Lin,
	open list:TTY LAYER AND SERIAL DRIVERS,
	open list:TTY LAYER AND SERIAL DRIVERS

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() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
 drivers/tty/serial/sprd_serial.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 092755f35683..3fdf5939a62c 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -741,11 +741,8 @@ static int sprd_startup(struct uart_port *port)
 
 	ret = devm_request_irq(port->dev, port->irq, sprd_handle_irq,
 			       IRQF_SHARED, sp->name, port);
-	if (ret) {
-		dev_err(port->dev, "fail to request serial irq %d, ret=%d\n",
-			port->irq, ret);
+	if (ret)
 		return ret;
-	}
 	fc = serial_in(port, SPRD_CTL1);
 	fc |= RX_TOUT_THLD_DEF | RX_HFC_THLD_DEF;
 	serial_out(port, SPRD_CTL1, fc);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ 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; 7+ 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] 7+ messages in thread

end of thread, other threads:[~2026-07-22  3:57 UTC | newest]

Thread overview: 7+ 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 1/5] serial: 8250_bcm7271: Remove redundant dev_err_probe() 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
2026-07-22  3:43 ` [PATCH 3/5] serial: mvebu-uart: " Pan Chuang
2026-07-22  3:43 ` [PATCH 4/5] serial: mctrl_gpio: " Pan Chuang
2026-07-22  3:43 ` [PATCH 5/5] serial: sprd: " Pan Chuang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.