linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
@ 2021-04-06 17:01 Colin King
  2021-04-06 18:13 ` Dinh Nguyen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2021-04-06 17:01 UTC (permalink / raw)
  To: Dinh Nguyen, Michael Turquette, Stephen Boyd, linux-clk
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

There is an error return path that is not kfree'ing socfpga_clk leading
to a memory leak. Fix this by adding in the missing kfree call.

Addresses-Coverity: ("Resource leak")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/clk/socfpga/clk-gate-a10.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c
index f5cba8298712..738c53391e39 100644
--- a/drivers/clk/socfpga/clk-gate-a10.c
+++ b/drivers/clk/socfpga/clk-gate-a10.c
@@ -146,6 +146,7 @@ static void __init __socfpga_gate_init(struct device_node *node,
 		if (IS_ERR(socfpga_clk->sys_mgr_base_addr)) {
 			pr_err("%s: failed to find altr,sys-mgr regmap!\n",
 					__func__);
+			kfree(socfpga_clk);
 			return;
 		}
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
  2021-04-06 17:01 [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return Colin King
@ 2021-04-06 18:13 ` Dinh Nguyen
  2021-04-07  8:59 ` Krzysztof Kozlowski
  2021-04-07 23:29 ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Dinh Nguyen @ 2021-04-06 18:13 UTC (permalink / raw)
  To: Colin King, Michael Turquette, Stephen Boyd, linux-clk
  Cc: kernel-janitors, linux-kernel



On 4/6/21 12:01 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is an error return path that is not kfree'ing socfpga_clk leading
> to a memory leak. Fix this by adding in the missing kfree call.
> 
> Addresses-Coverity: ("Resource leak")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/clk/socfpga/clk-gate-a10.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c
> index f5cba8298712..738c53391e39 100644
> --- a/drivers/clk/socfpga/clk-gate-a10.c
> +++ b/drivers/clk/socfpga/clk-gate-a10.c
> @@ -146,6 +146,7 @@ static void __init __socfpga_gate_init(struct device_node *node,
>   		if (IS_ERR(socfpga_clk->sys_mgr_base_addr)) {
>   			pr_err("%s: failed to find altr,sys-mgr regmap!\n",
>   					__func__);
> +			kfree(socfpga_clk);
>   			return;
>   		}
>   	}
> 

Acked-by: Dinh Nguyen <dinguyen@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
  2021-04-06 17:01 [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return Colin King
  2021-04-06 18:13 ` Dinh Nguyen
@ 2021-04-07  8:59 ` Krzysztof Kozlowski
  2021-04-07 23:29 ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-07  8:59 UTC (permalink / raw)
  To: Colin King, Dinh Nguyen, Michael Turquette, Stephen Boyd, linux-clk
  Cc: kernel-janitors, linux-kernel

On 06/04/2021 19:01, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is an error return path that is not kfree'ing socfpga_clk leading
> to a memory leak. Fix this by adding in the missing kfree call.
> 
> Addresses-Coverity: ("Resource leak")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/clk/socfpga/clk-gate-a10.c | 1 +
>  1 file changed, 1 insertion(+)


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
  2021-04-06 17:01 [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return Colin King
  2021-04-06 18:13 ` Dinh Nguyen
  2021-04-07  8:59 ` Krzysztof Kozlowski
@ 2021-04-07 23:29 ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2021-04-07 23:29 UTC (permalink / raw)
  To: Colin King, Dinh Nguyen, Michael Turquette, linux-clk
  Cc: kernel-janitors, linux-kernel

Quoting Colin King (2021-04-06 10:01:15)
> From: Colin Ian King <colin.king@canonical.com>
> 
> There is an error return path that is not kfree'ing socfpga_clk leading
> to a memory leak. Fix this by adding in the missing kfree call.
> 
> Addresses-Coverity: ("Resource leak")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-07 23:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 17:01 [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return Colin King
2021-04-06 18:13 ` Dinh Nguyen
2021-04-07  8:59 ` Krzysztof Kozlowski
2021-04-07 23:29 ` Stephen Boyd

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).