mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tty: serial: ma35d1_serial: Add missing check for ioremap
@ 2023-09-15  7:11 Chen Ni
  2023-09-15  9:49 ` Jacky Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Ni @ 2023-09-15  7:11 UTC (permalink / raw)
  To: ychuang3, schung, gregkh, jirislaby, ilpo.jarvinen
  Cc: linux-arm-kernel, linux-kernel, linux-serial, Chen Ni

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 <nichen@iscas.ac.cn>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] tty: serial: ma35d1_serial: Add missing check for ioremap
@ 2023-09-04  3:40 Chen Ni
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Ni @ 2023-09-04  3:40 UTC (permalink / raw)
  To: ychuang3, schung, gregkh, jirislaby, ilpo.jarvinen
  Cc: linux-arm-kernel, linux-kernel, linux-serial, Chen Ni

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

Fixes: 930cbf92db01 ("tty: serial: Add Nuvoton ma35d1 serial driver support")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 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..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);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-15  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15  7:11 [PATCH] tty: serial: ma35d1_serial: Add missing check for ioremap Chen Ni
2023-09-15  9:49 ` Jacky Huang
  -- strict thread matches above, loose matches on Subject: below --
2023-09-04  3:40 Chen Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®