public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Dinh Nguyen <dinguyen@kernel.org>
To: Colin King <colin.king@canonical.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
Date: Tue, 6 Apr 2021 13:13:56 -0500	[thread overview]
Message-ID: <8ad43a2d-ac0f-8c19-6e1a-82811a9d4495@kernel.org> (raw)
In-Reply-To: <20210406170115.430990-1-colin.king@canonical.com>



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>

  reply	other threads:[~2021-04-06 18:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-04-07  8:59 ` Krzysztof Kozlowski
2021-04-07 23:29 ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ad43a2d-ac0f-8c19-6e1a-82811a9d4495@kernel.org \
    --to=dinguyen@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox