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:
J. Neuschäfer
2026-03-03 16:25:18 +01:00
committed by Stephen Boyd
parent 9a51504d7c
commit 7b03559044

View File

@@ -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;
}