[PATCH] serial: atmel: Check return value of platform_get_irq() in atmel_init_port()
Hari.PrasathGE at microchip.com
Hari.PrasathGE at microchip.com
Thu Oct 19 01:45:13 PDT 2023
On 18/10/23 2:45 pm, Yi Yang wrote:
> [You don't often get email from yiyang13 at huawei.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> The platform_get_irq() might be failed and return a negative result, there
> should be return an error code when platform_get_irq() failed.
> Fix it by add check return value of platform_get_irq().
>
> Fixes: 5bb221b0ad65 ("serial: atmel: Use platform_get_irq() to get the interrupt")
> Signed-off-by: Yi Yang <yiyang13 at huawei.com>
> ---
> drivers/tty/serial/atmel_serial.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 1946fafc3f3e..4984bec88445 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -2540,13 +2540,17 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,
> atmel_init_property(atmel_port, pdev);
> atmel_set_ops(port);
>
> + ret = platform_get_irq(mpdev, 0);
> + if (ret < 0)
> + return 0;
> +
> port->iotype = UPIO_MEM;
> port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP;
> port->ops = &atmel_pops;
> port->fifosize = 1;
> port->dev = &pdev->dev;
> port->mapbase = mpdev->resource[0].start;
> - port->irq = platform_get_irq(mpdev, 0);
> + port->irq = ret;
Pls rename 'ret' to something like 'irq' and make this assignment right
after platform_get_irq() succeeds above.
> port->rs485_config = atmel_config_rs485;
> port->rs485_supported = atmel_rs485_supported;
> port->iso7816_config = atmel_config_iso7816;
> --
> 2.25.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
More information about the linux-arm-kernel
mailing list