mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] serial: ucc_uart: Use platform IRQ helper
@ 2026-09-27 20:43 Rosen Penev
  2026-10-01  8:45 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Rosen Penev @ 2026-09-27 20:43 UTC (permalink / raw)
  To: linux-serial
  Cc: Timur Tabi, Greg Kroah-Hartman, Jiri Slaby,
	open list:FREESCALE QUICC ENGINE UCC UART DRIVER,
	open list:TTY LAYER AND SERIAL DRIVERS

Avoid calling irq_dispose_mapping() by letting the platform_device
machinery handle it. Also enable possibility of handling -EPROBE_DEFER
and other errors. Handle before any allocation or anything to avoid
dealing with gotos.

Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v2: move platform_get_irq() earlier.
 drivers/tty/serial/ucc_uart.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 6b7dcbbacd13..96e3c9534de7 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -26,7 +26,6 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
 #include <linux/dma-mapping.h>
 
 #include <soc/fsl/qe/ucc_slow.h>
@@ -1238,8 +1237,13 @@ static int ucc_uart_probe(struct platform_device *ofdev)
 	struct uart_qe_port *qe_port = NULL;
 	struct resource res;
 	u32 val;
+	int irq;
 	int ret;
 
+	irq = platform_get_irq(ofdev, 0);
+	if (irq < 0)
+		return irq;
+
 	/*
 	 * Determine if we need Soft-UART mode
 	 */
@@ -1338,13 +1342,7 @@ static int ucc_uart_probe(struct platform_device *ofdev)
 		goto out_free;
 	}
 
-	qe_port->port.irq = irq_of_parse_and_map(np, 0);
-	if (qe_port->port.irq == 0) {
-		dev_err(&ofdev->dev, "could not map IRQ for UCC%u\n",
-		       qe_port->ucc_num + 1);
-		ret = -EINVAL;
-		goto out_free;
-	}
+	qe_port->port.irq = irq;
 
 	/*
 	 * Newer device trees have an "fsl,qe" compatible property for the QE
-- 
2.55.0


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

* Re: [PATCH v2] serial: ucc_uart: Use platform IRQ helper
  2026-09-27 20:43 [PATCH v2] serial: ucc_uart: Use platform IRQ helper Rosen Penev
@ 2026-10-01  8:45 ` Greg Kroah-Hartman
  2026-10-02  2:04   ` Rosen Penev
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-10-01  8:45 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-serial, Timur Tabi, Jiri Slaby,
	open list:FREESCALE QUICC ENGINE UCC UART DRIVER,
	open list:TTY LAYER AND SERIAL DRIVERS

On Sun, Sep 27, 2026 at 01:43:17PM -0700, Rosen Penev wrote:
> Avoid calling irq_dispose_mapping() by letting the platform_device
> machinery handle it. Also enable possibility of handling -EPROBE_DEFER
> and other errors. Handle before any allocation or anything to avoid
> dealing with gotos.

I can't really parse this, what is the bug here that you are fixing?

> Assisted-by: LLM
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  v2: move platform_get_irq() earlier.

Why?

thanks,

greg k-h

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

* Re: [PATCH v2] serial: ucc_uart: Use platform IRQ helper
  2026-10-01  8:45 ` Greg Kroah-Hartman
@ 2026-10-02  2:04   ` Rosen Penev
  0 siblings, 0 replies; 3+ messages in thread
From: Rosen Penev @ 2026-10-02  2:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-serial, Timur Tabi, Jiri Slaby,
	open list:FREESCALE QUICC ENGINE UCC UART DRIVER,
	open list:TTY LAYER AND SERIAL DRIVERS

On Thu, Oct 1, 2026 at 1:45 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Sun, Sep 27, 2026 at 01:43:17PM -0700, Rosen Penev wrote:
> > Avoid calling irq_dispose_mapping() by letting the platform_device
> > machinery handle it. Also enable possibility of handling -EPROBE_DEFER
> > and other errors. Handle before any allocation or anything to avoid
> > dealing with gotos.
>
> I can't really parse this, what is the bug here that you are fixing?
>
> > Assisted-by: LLM
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  v2: move platform_get_irq() earlier.
>
> Why?
this was reported by sashiko in v1:

[Severity: High]
If platform_get_irq() returns -EPROBE_DEFER here, does this leak the
asynchronous firmware load initiated by the preceding call to
soft_uart_init()?
>
> thanks,
>
> greg k-h

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

end of thread, other threads:[~2026-10-02  2:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 20:43 [PATCH v2] serial: ucc_uart: Use platform IRQ helper Rosen Penev
2026-10-01  8:45 ` Greg Kroah-Hartman
2026-10-02  2:04   ` Rosen Penev

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®