linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: st-asc: Fix to check return value of platform_get_irq() in asc_init_port()
@ 2023-07-23  4:28 Zhang Shurong
  2023-07-30 11:54 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Shurong @ 2023-07-23  4:28 UTC (permalink / raw)
  To: patrice.chotard
  Cc: gregkh, jirislaby, linux-arm-kernel, linux-serial, linux-kernel,
	Zhang Shurong

The platform_get_irq might be failed and return a negative result. So
there should have an error handling code.

Fixed this by adding an error handling code.

Fixes: c4b058560762 ("serial:st-asc: Add ST ASC driver.")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 drivers/tty/serial/st-asc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index aa471c9c24d9..2f1807fa9bdb 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -688,9 +688,13 @@ static int asc_init_port(struct asc_port *ascport,
 	port->ops	= &asc_uart_ops;
 	port->fifosize	= ASC_FIFO_SIZE;
 	port->dev	= &pdev->dev;
-	port->irq	= platform_get_irq(pdev, 0);
 	port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE);
 
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+	port->irq = ret;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	port->membase = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(port->membase))
-- 
2.41.0


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

* Re: [PATCH] serial: st-asc: Fix to check return value of platform_get_irq() in asc_init_port()
  2023-07-23  4:28 [PATCH] serial: st-asc: Fix to check return value of platform_get_irq() in asc_init_port() Zhang Shurong
@ 2023-07-30 11:54 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2023-07-30 11:54 UTC (permalink / raw)
  To: Zhang Shurong
  Cc: patrice.chotard, jirislaby, linux-arm-kernel, linux-serial,
	linux-kernel

On Sun, Jul 23, 2023 at 12:28:47PM +0800, Zhang Shurong wrote:
> The platform_get_irq might be failed and return a negative result. So
> there should have an error handling code.
> 
> Fixed this by adding an error handling code.
> 
> Fixes: c4b058560762 ("serial:st-asc: Add ST ASC driver.")
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
> ---
>  drivers/tty/serial/st-asc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
> index aa471c9c24d9..2f1807fa9bdb 100644
> --- a/drivers/tty/serial/st-asc.c
> +++ b/drivers/tty/serial/st-asc.c
> @@ -688,9 +688,13 @@ static int asc_init_port(struct asc_port *ascport,
>  	port->ops	= &asc_uart_ops;
>  	port->fifosize	= ASC_FIFO_SIZE;
>  	port->dev	= &pdev->dev;
> -	port->irq	= platform_get_irq(pdev, 0);
>  	port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE);
>  
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		return ret;
> +	port->irq = ret;
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	port->membase = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(port->membase))
> -- 
> 2.41.0
> 

Does not apply to my tty-next tree :(


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

end of thread, other threads:[~2023-07-30 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-23  4:28 [PATCH] serial: st-asc: Fix to check return value of platform_get_irq() in asc_init_port() Zhang Shurong
2023-07-30 11:54 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).