diff mbox series

tty: serial: linflexuart: Fix to check return value of platform_get_irq() in linflex_probe()

Message ID tencent_234B0AACD06350E10D7548C2E086A9166305@qq.com
State New
Headers show
Series tty: serial: linflexuart: Fix to check return value of platform_get_irq() in linflex_probe() | expand

Commit Message

Zhang Shurong Aug. 26, 2023, 9:32 a.m. UTC
The platform_get_irq might be failed and return a negative result. So
there should have an error handling code.

Fixed this by adding an error handling code.

Fixes: 09864c1cdf5c ("tty: serial: Add linflexuart driver for S32V234.")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 drivers/tty/serial/fsl_linflexuart.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c
index 3e28be402aef..7a7461543bb4 100644
--- a/drivers/tty/serial/fsl_linflexuart.c
+++ b/drivers/tty/serial/fsl_linflexuart.c
@@ -850,10 +850,14 @@  static int linflex_probe(struct platform_device *pdev)
 	if (IS_ERR(sport->membase))
 		return PTR_ERR(sport->membase);
 
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
+
 	sport->dev = &pdev->dev;
 	sport->type = PORT_LINFLEXUART;
 	sport->iotype = UPIO_MEM;
-	sport->irq = platform_get_irq(pdev, 0);
+	sport->irq = ret;
 	sport->ops = &linflex_pops;
 	sport->flags = UPF_BOOT_AUTOCONF;
 	sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE);