Re: [PATCH] serial: st-asc: Check return value of platform_get_irq() in asc_init_port()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 18 Oct 2023 09:12:40 +0000
Yi Yang <yiyang13@xxxxxxxxxx> wrote:

Hi,

> The platform_get_irq() might be failed and return a negative result, there

Change to:

"platform_get_irq() might fail and return a negative result."

> should be return an error code when platform_get_irq() failed.
> Fix it by add check return value of platform_get_irq().

and maybe something along:

"Return an error code when platform_get_irq() fails."

Hugo.

 
> Fixes: c4b058560762 ("serial:st-asc: Add ST ASC driver.")
> Signed-off-by: Yi Yang <yiyang13@xxxxxxxxxx>
> ---
>  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 a821f5d76a26..8321167502dc 100644
> --- a/drivers/tty/serial/st-asc.c
> +++ b/drivers/tty/serial/st-asc.c
> @@ -683,12 +683,16 @@ static int asc_init_port(struct asc_port *ascport,
>  	struct resource *res;
>  	int ret;
>  
> +	ret = platform_get_irq(pdev, 0);
> +	if (ret < 0)
> +		return ret;
> +
>  	port->iotype	= UPIO_MEM;
>  	port->flags	= UPF_BOOT_AUTOCONF;
>  	port->ops	= &asc_uart_ops;
>  	port->fifosize	= ASC_FIFO_SIZE;
>  	port->dev	= &pdev->dev;
> -	port->irq	= platform_get_irq(pdev, 0);
> +	port->irq	= ret;
>  	port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE);
>  
>  	port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> -- 
> 2.25.1
> 



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux