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>
This commit is contained in:
Chen Ni 2023-09-15 07:11:06 +00:00 committed by Greg Kroah-Hartman
parent ce9ecca023
commit 4556c36f4a

View 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);