Thread (2 messages) 2 messages, 2 authors, 2023-09-15
STALE1048d LANDED

[PATCH] tty: serial: ma35d1_serial: Add missing check for ioremap

From: Chen Ni <hidden>
Date: 2023-09-15 07:12:43
Also in: linux-serial, lkml
Subsystem: arm/nuvoton ma35 architecture, the rest, tty layer and serial drivers · Maintainers: Jacky Huang, Shan-Chun Hung, Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

Add check for ioremap() and return the error if it fails in order to
guarantee the success of ioremap().

Fixes: 930cbf92db01 ("tty: serial: Add Nuvoton ma35d1 serial driver support")
Signed-off-by: Chen Ni <redacted>
---
 drivers/tty/serial/ma35d1_serial.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
index 465b1def9e11..4a9d1252de35 100644
--- a/drivers/tty/serial/ma35d1_serial.c
+++ b/drivers/tty/serial/ma35d1_serial.c
@@ -695,6 +695,9 @@ static int ma35d1serial_probe(struct platform_device *pdev)
 
 	up->port.iobase = res_mem->start;
 	up->port.membase = ioremap(up->port.iobase, MA35_UART_REG_SIZE);
+	if (!up->port.membase)
+		return -ENOMEM;
+
 	up->port.ops = &ma35d1serial_ops;
 
 	spin_lock_init(&up->port.lock);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help