[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221222091221.28308-1-taolan@huawei.com>
Date: Thu, 22 Dec 2022 09:12:21 +0000
From: Tao Lan <taolan@...wei.com>
To: <mturquette@...libre.com>, <sboyd@...nel.org>
CC: <j.neuschaefer@....net>, <linux-clk@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, taolan <taolan@...wei.com>
Subject: [PATCH] clk: fix memory leak in hisi_clk_init.
From: taolan <taolan@...wei.com>
when clk_data create fail, we also need to release base.
Signed-off-by: taolan <taolan@...wei.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
Powered by blists - more mailing lists