lkml.org 
[lkml]   [2023]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] tty: serial: linflexuart: Fix to check return value of platform_get_irq() in linflex_probe()
Date
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 --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
\
 
 \ /
  Last update: 2023-08-26 11:34    [W:0.048 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site