* [PATCH] tty: serial: samsung_tty: Fix clk resource leak issue
@ 2022-11-07 6:21 Xiu Jianfeng
2022-11-07 7:17 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Xiu Jianfeng @ 2022-11-07 6:21 UTC (permalink / raw)
To: krzysztof.kozlowski, alim.akhtar, gregkh, jirislaby, ben-linux
Cc: linux-arm-kernel, linux-samsung-soc, linux-serial, linux-kernel
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 --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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: serial: samsung_tty: Fix clk resource leak issue
2022-11-07 6:21 [PATCH] tty: serial: samsung_tty: Fix clk resource leak issue Xiu Jianfeng
@ 2022-11-07 7:17 ` Greg KH
2022-11-07 8:56 ` Krzysztof Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2022-11-07 7:17 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: krzysztof.kozlowski, alim.akhtar, jirislaby, ben-linux,
linux-arm-kernel, linux-samsung-soc, linux-serial, linux-kernel
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@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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: serial: samsung_tty: Fix clk resource leak issue
2022-11-07 7:17 ` Greg KH
@ 2022-11-07 8:56 ` Krzysztof Kozlowski
0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2022-11-07 8:56 UTC (permalink / raw)
To: Greg KH, Xiu Jianfeng
Cc: alim.akhtar, jirislaby, ben-linux, linux-arm-kernel,
linux-samsung-soc, linux-serial, linux-kernel
On 07/11/2022 08:17, Greg KH wrote:
> 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@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?
The driver has such potential missing clk_put in few other places as
well: here on success path and few error paths after calling
s3c24xx_serial_enable_baudclk(). Yet I am concerned that none of these
paths were actually tested...
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-07 9:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 6:21 [PATCH] tty: serial: samsung_tty: Fix clk resource leak issue Xiu Jianfeng
2022-11-07 7:17 ` Greg KH
2022-11-07 8:56 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).