mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 01:08:13 -04:00
clk: hisilicon: Improve deallocation in error path
Unmap 'base' if an error occurs after it has been mapped. Reported-by: Tao Lan <taolan@huawei.com> Closes: https://lore.kernel.org/lkml/ZNlSH+eWV8Sk3FYn@probook/ Signed-off-by: J. Neuschäfer <j.ne@posteo.net> Reviewed-by: Brian Masney <bmasney@redhat.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
committed by
Stephen Boyd
parent
9a51504d7c
commit
7b03559044
@@ -70,7 +70,7 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np,
|
||||
|
||||
clk_data = kzalloc_obj(*clk_data);
|
||||
if (!clk_data)
|
||||
goto err;
|
||||
goto err_base;
|
||||
|
||||
clk_data->base = base;
|
||||
clk_table = kzalloc_objs(*clk_table, nr_clks);
|
||||
@@ -83,6 +83,8 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np,
|
||||
return clk_data;
|
||||
err_data:
|
||||
kfree(clk_data);
|
||||
err_base:
|
||||
iounmap(base);
|
||||
err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user