mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-22 08:44:09 +07:00
clk: mvebu/clk-cpu.c: fix memory leakage
the variable cpuclk and clk_name should be properly freed when error happens. Signed-off-by: Cong Ding <dinggnu@gmail.com> Acked-by: Jason Cooper <jason@lakedaemon.net> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Acked-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
This commit is contained in:
parent
11d5993df2
commit
d6f620a457
@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node)
|
|||||||
|
|
||||||
clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
|
clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
|
||||||
if (WARN_ON(!clks))
|
if (WARN_ON(!clks))
|
||||||
return;
|
goto clks_out;
|
||||||
|
|
||||||
for_each_node_by_type(dn, "cpu") {
|
for_each_node_by_type(dn, "cpu") {
|
||||||
struct clk_init_data init;
|
struct clk_init_data init;
|
||||||
@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node)
|
|||||||
int cpu, err;
|
int cpu, err;
|
||||||
|
|
||||||
if (WARN_ON(!clk_name))
|
if (WARN_ON(!clk_name))
|
||||||
return;
|
goto bail_out;
|
||||||
|
|
||||||
err = of_property_read_u32(dn, "reg", &cpu);
|
err = of_property_read_u32(dn, "reg", &cpu);
|
||||||
if (WARN_ON(err))
|
if (WARN_ON(err))
|
||||||
return;
|
goto bail_out;
|
||||||
|
|
||||||
sprintf(clk_name, "cpu%d", cpu);
|
sprintf(clk_name, "cpu%d", cpu);
|
||||||
parent_clk = of_clk_get(node, 0);
|
parent_clk = of_clk_get(node, 0);
|
||||||
@ -167,6 +167,9 @@ void __init of_cpu_clk_setup(struct device_node *node)
|
|||||||
return;
|
return;
|
||||||
bail_out:
|
bail_out:
|
||||||
kfree(clks);
|
kfree(clks);
|
||||||
|
while(ncpus--)
|
||||||
|
kfree(cpuclk[ncpus].clk_name);
|
||||||
|
clks_out:
|
||||||
kfree(cpuclk);
|
kfree(cpuclk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user