Commit e0f2a902 authored by Erwan Le Ray's avatar Erwan Le Ray Committed by Greg Kroah-Hartman
Browse files

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: default avatarJiri Slaby <jirislaby@kernel.org>
Signed-off-by: default avatarErwan Le Ray <erwan.leray@foss.st.com>

Link: https://lore.kernel.org/r/20210121142309.6327-1-erwan.leray@foss.st.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e9103f47
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -981,11 +981,11 @@ static int stm32_usart_init_port(struct stm32_port *stm32port,
{
	struct uart_port *port = &stm32port->port;
	struct resource *res;
	int ret;
	int ret, irq;

	ret = platform_get_irq(pdev, 0);
	if (ret <= 0)
		return ret ? : -ENODEV;
	irq = platform_get_irq(pdev, 0);
	if (irq <= 0)
		return irq ? : -ENODEV;

	port->iotype	= UPIO_MEM;
	port->flags	= UPF_BOOT_AUTOCONF;
@@ -993,7 +993,7 @@ static int stm32_usart_init_port(struct stm32_port *stm32port,
	port->dev	= &pdev->dev;
	port->fifosize	= stm32port->info->cfg.fifosize;
	port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE);
	port->irq = ret;
	port->irq = irq;
	port->rs485_config = stm32_usart_config_rs485;

	ret = stm32_usart_init_rs485(port, pdev);