[PATCH] tty: serial: samsung_tty: Fix clk resource leak issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 drivers/tty/serial/samsung_tty.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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




[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux