Thread (10 messages) 10 messages, 3 authors, 2020-03-18
STALE2302d

[PATCH v2 2/2] serial: sprd: cleanup the sprd_port for error case

From: Chunyan Zhang <zhang.lyra@gmail.com>
Date: 2020-03-18 08:31:37
Also in: lkml
Subsystem: the rest, tty layer and serial drivers · Maintainers: Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

From: Chunyan Zhang <redacted>

It would be better to cleanup the sprd_port for the device before
return error.

Signed-off-by: Chunyan Zhang <redacted>
---
 drivers/tty/serial/sprd_serial.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 9f8c14ff6454..54477de9822f 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -1204,8 +1204,10 @@ static int sprd_probe(struct platform_device *pdev)
 	up->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SPRD_CONSOLE);
 
 	ret = sprd_clk_init(up);
-	if (ret)
+	if (ret) {
+		sprd_port[index] = NULL;
 		return ret;
+	}
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	up->membase = devm_ioremap_resource(&pdev->dev, res);
-- 
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help