summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/ma35d1_serial.c
diff options
context:
space:
mode:
authorChen Ni <nichen@iscas.ac.cn>2023-09-15 07:11:06 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-09-18 11:14:42 +0200
commit4556c36f4a23fb218763cdb7a20f6a94f4faf1f8 (patch)
tree901a067342c60e684075f82a2f6f578c4aa455fe /drivers/tty/serial/ma35d1_serial.c
parentce9ecca0238b140b88f43859b211c9fdfd8e5b70 (diff)
tty: serial: ma35d1_serial: Add missing check for ioremap
Add check for ioremap() and return the error if it fails in order to guarantee the success of ioremap(). Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Acked-by: Jacky Huang <ychuang3@nuvoton.com> Link: https://lore.kernel.org/r/20230915071106.3347-1-nichen@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/ma35d1_serial.c')
-rw-r--r--drivers/tty/serial/ma35d1_serial.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
index 465b1def9e11..dbfcb711e710 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);