[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_234B0AACD06350E10D7548C2E086A9166305@qq.com>
Date: Sat, 26 Aug 2023 17:32:24 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: gregkh@...uxfoundation.org
Cc: jslaby@...e.com, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zhang Shurong <zhang_shurong@...mail.com>
Subject: [PATCH] tty: serial: linflexuart: Fix to check return value of platform_get_irq() in linflex_probe()
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@...mail.com>
---
drivers/tty/serial/fsl_linflexuart.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
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);
--
2.30.2
Powered by blists - more mailing lists