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

Greg KH gregkh at linuxfoundation.org
Sun Nov 6 23:17:13 PST 2022


On Mon, Nov 07, 2022 at 02:21:20PM +0800, Xiu Jianfeng wrote:
> 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 at huawei.com>
> ---
>  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

How was this tested?

thanks,

greg k-h



More information about the linux-arm-kernel mailing list