From: Tao Lan <taolan@huawei.com>
To: <mturquette@baylibre.com>, <sboyd@kernel.org>
Cc: <j.neuschaefer@gmx.net>, <linux-clk@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, taolan <taolan@huawei.com>
Subject: [PATCH] clk: fix memory leak in hisi_clk_init.
Date: Thu, 22 Dec 2022 09:12:21 +0000 [thread overview]
Message-ID: <20221222091221.28308-1-taolan@huawei.com> (raw)
From: taolan <taolan@huawei.com>
when clk_data create fail, we also need to release base.
Signed-off-by: taolan <taolan@huawei.com>
---
drivers/clk/hisilicon/clk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
index 54d9fdc93599..9ca4fc05fa57 100644
--- a/drivers/clk/hisilicon/clk.c
+++ b/drivers/clk/hisilicon/clk.c
@@ -82,6 +82,10 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np,
of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data->clk_data);
return clk_data;
err_data:
+ if (base) {
+ iounmap(base);
+ base = NULL;
+ }
kfree(clk_data);
err:
return NULL;
--
2.17.1
next reply other threads:[~2022-12-22 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-22 9:12 Tao Lan [this message]
2023-08-13 21:58 ` [PATCH] clk: fix memory leak in hisi_clk_init Jonathan Neuschäfer
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=20221222091221.28308-1-taolan@huawei.com \
--to=taolan@huawei.com \
--cc=j.neuschaefer@gmx.net \
--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