From: Chen Ni Date: Fri, 15 Sep 2023 07:11:06 +0000 (+0000) Subject: tty: serial: ma35d1_serial: Add missing check for ioremap X-Git-Tag: v6.7-rc1~75^2~194 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4556c36f4a23fb218763cdb7a20f6a94f4faf1f8;p=thirdparty%2Flinux.git 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 Acked-by: Jacky Huang Link: https://lore.kernel.org/r/20230915071106.3347-1-nichen@iscas.ac.cn Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c index 465b1def9e119..dbfcb711e7102 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);