Commit e0e04fc8 authored by Stephen Boyd's avatar Stephen Boyd

clk: ti: Don't reference clk_init_data after registration

A future patch is going to change semantics of clk_register() so that
clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid
referencing this member here so that we don't run into NULL pointer
exceptions.

Cc: Tero Kristo <t-kristo@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Reported-by: default avatar"kernelci.org bot" <bot@kernelci.org>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Link: https://lkml.kernel.org/r/20190815221249.53235-1-sboyd@kernel.org
parent c4214413
...@@ -140,6 +140,7 @@ static void __init omap_clk_register_apll(void *user, ...@@ -140,6 +140,7 @@ static void __init omap_clk_register_apll(void *user,
struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
struct dpll_data *ad = clk_hw->dpll_data; struct dpll_data *ad = clk_hw->dpll_data;
struct clk *clk; struct clk *clk;
const struct clk_init_data *init = clk_hw->hw.init;
clk = of_clk_get(node, 0); clk = of_clk_get(node, 0);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
...@@ -168,15 +169,15 @@ static void __init omap_clk_register_apll(void *user, ...@@ -168,15 +169,15 @@ static void __init omap_clk_register_apll(void *user,
clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name); clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);
kfree(clk_hw->hw.init->parent_names); kfree(init->parent_names);
kfree(clk_hw->hw.init); kfree(init);
return; return;
} }
cleanup: cleanup:
kfree(clk_hw->dpll_data); kfree(clk_hw->dpll_data);
kfree(clk_hw->hw.init->parent_names); kfree(init->parent_names);
kfree(clk_hw->hw.init); kfree(init);
kfree(clk_hw); kfree(clk_hw);
} }
......
...@@ -165,6 +165,7 @@ static void __init _register_dpll(void *user, ...@@ -165,6 +165,7 @@ static void __init _register_dpll(void *user,
struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw); struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
struct dpll_data *dd = clk_hw->dpll_data; struct dpll_data *dd = clk_hw->dpll_data;
struct clk *clk; struct clk *clk;
const struct clk_init_data *init = hw->init;
clk = of_clk_get(node, 0); clk = of_clk_get(node, 0);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
...@@ -196,15 +197,15 @@ static void __init _register_dpll(void *user, ...@@ -196,15 +197,15 @@ static void __init _register_dpll(void *user,
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk); of_clk_add_provider(node, of_clk_src_simple_get, clk);
kfree(clk_hw->hw.init->parent_names); kfree(init->parent_names);
kfree(clk_hw->hw.init); kfree(init);
return; return;
} }
cleanup: cleanup:
kfree(clk_hw->dpll_data); kfree(clk_hw->dpll_data);
kfree(clk_hw->hw.init->parent_names); kfree(init->parent_names);
kfree(clk_hw->hw.init); kfree(init);
kfree(clk_hw); kfree(clk_hw);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment