]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
clk: hisilicon: Improve deallocation in error path
authorJ. Neuschäfer <j.ne@posteo.net>
Tue, 3 Mar 2026 15:25:18 +0000 (16:25 +0100)
committerStephen Boyd <sboyd@kernel.org>
Wed, 29 Apr 2026 03:52:43 +0000 (20:52 -0700)
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>
drivers/clk/hisilicon/clk.c

index fae65127cd4aa8922c982baf8f5169be59e406f6..08050ff1c8cf9a4f875cef93d20cc20b7bb3676a 100644 (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;
 }