[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]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux