]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tty: serial: ma35d1_serial: Add missing check for ioremap
authorChen Ni <nichen@iscas.ac.cn>
Fri, 15 Sep 2023 07:11:06 +0000 (07:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Sep 2023 09:14:42 +0000 (11:14 +0200)
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>
drivers/tty/serial/ma35d1_serial.c

index 465b1def9e119b6a7cbb8a863e741916d2b9ef0d..dbfcb711e71028145dcad3804072ec7ea741eb88 100644 (file)
@@ -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);