Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: stm32: improve platform_get_irq condition handling in init_port

Replace "ret" variable by "irq" variable from platform_get_irq condition
handling in stm32_init_port as suggested by Jiri in "STM32 uart cleanup and
improvement" series review.
This change will prevent port->irq to be unexpectly modified by a potential
change of "ret" value introduced by a new patch.

Suggested-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>

Link: https://lore.kernel.org/r/20210121142309.6327-1-erwan.leray@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Erwan Le Ray and committed by
Greg Kroah-Hartman
e0f2a902 e9103f47

+5 -5
+5 -5
drivers/tty/serial/stm32-usart.c
··· 981 981 { 982 982 struct uart_port *port = &stm32port->port; 983 983 struct resource *res; 984 - int ret; 984 + int ret, irq; 985 985 986 - ret = platform_get_irq(pdev, 0); 987 - if (ret <= 0) 988 - return ret ? : -ENODEV; 986 + irq = platform_get_irq(pdev, 0); 987 + if (irq <= 0) 988 + return irq ? : -ENODEV; 989 989 990 990 port->iotype = UPIO_MEM; 991 991 port->flags = UPF_BOOT_AUTOCONF; ··· 993 993 port->dev = &pdev->dev; 994 994 port->fifosize = stm32port->info->cfg.fifosize; 995 995 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); 996 - port->irq = ret; 996 + port->irq = irq; 997 997 port->rs485_config = stm32_usart_config_rs485; 998 998 999 999 ret = stm32_usart_init_rs485(port, pdev);