public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: fix memory leak in hisi_clk_init.
@ 2022-12-22  9:12 Tao Lan
  2023-08-13 21:58 ` Jonathan Neuschäfer
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Lan @ 2022-12-22  9:12 UTC (permalink / raw)
  To: mturquette, sboyd; +Cc: j.neuschaefer, linux-clk, linux-kernel, taolan

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


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

end of thread, other threads:[~2023-08-13 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22  9:12 [PATCH] clk: fix memory leak in hisi_clk_init Tao Lan
2023-08-13 21:58 ` Jonathan Neuschäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox