linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] serial: stm32: improve platform_get_irq condition handling in init_port
@ 2021-01-21 14:23 Erwan Le Ray
  0 siblings, 0 replies; only message in thread
From: Erwan Le Ray @ 2021-01-21 14:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Maxime Coquelin, Alexandre Torgue
  Cc: linux-serial, linux-stm32, linux-arm-kernel, linux-kernel,
	Erwan Le Ray, Fabrice Gasnier, Valentin Caron

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>

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 6a9a5ef5f5ba..dde6d526362d 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-21 14:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 14:23 [PATCH 1/1] serial: stm32: improve platform_get_irq condition handling in init_port Erwan Le Ray

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).