diff mbox series

tty: serial: samsung_tty: Fix clk resource leak issue

Message ID 20221107062120.20321-1-xiujianfeng@huawei.com
State New
Headers show
Series tty: serial: samsung_tty: Fix clk resource leak issue | expand

Commit Message

xiujianfeng Nov. 7, 2022, 6:21 a.m. UTC
In the s3c24xx_serial_get_options(), calling clk_get() without clk_put()
will cause clk resource leak issue, this patch fixes it.

Fixes: b497549a035c ("[ARM] S3C24XX: Split serial driver into core and per-cpu drivers")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
 drivers/tty/serial/samsung_tty.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 77d1363029f5..8a3bb9832172 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -2529,9 +2529,10 @@  s3c24xx_serial_get_options(struct uart_port *port, int *baud,
 		sprintf(clk_name, "clk_uart_baud%d", clk_sel);
 
 		clk = clk_get(port->dev, clk_name);
-		if (!IS_ERR(clk))
+		if (!IS_ERR(clk)) {
 			rate = clk_get_rate(clk);
-		else
+			clk_put(clk);
+		} else
 			rate = 1;
 
 		*baud = rate / (16 * (ubrdiv + 1));