clk: ti: Don't reference clk_init_data after registration
Subsystems (2)
Stephen Boyd
maintainerPATCH 1/1 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.
---
This might be causing boot regressions in linux-next. Not sure.
drivers/clk/ti/apll.c | 9 +++++---- drivers/clk/ti/dpll.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/clk/ti/apll.c +5 -4
@@ -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 dpll_data *ad = clk_hw->dpll_data;struct clk *clk; +const struct clk_init_data *init = clk_hw->hw.init; clk =of_clk_get (node,0 );if (IS_ERR (clk)) {
@@ -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);if (!IS_ERR (clk)) {of_clk_add_provider (node, of_clk_src_simple_get, clk); -kfree (clk_hw->hw.init->parent_names); -kfree (clk_hw->hw.init); +kfree (init->parent_names); +kfree (init);return ; } cleanup:kfree (clk_hw->dpll_data); -kfree (clk_hw->hw.init->parent_names); -kfree (clk_hw->hw.init); +kfree (init->parent_names); +kfree (init);kfree (clk_hw); }
drivers/clk/ti/dpll.c +5 -4
@@ -165,6 +165,7 @@ static void __init _register_dpll(void *user,struct clk_hw_omap *clk_hw =to_clk_hw_omap (hw);struct dpll_data *dd = clk_hw->dpll_data;struct clk *clk; +const struct clk_init_data *init = hw->init; clk =of_clk_get (node,0 );if (IS_ERR (clk)) {
@@ -196,15 +197,15 @@ static void __init _register_dpll(void *user,if (!IS_ERR (clk)) {of_clk_add_provider (node, of_clk_src_simple_get, clk); -kfree (clk_hw->hw.init->parent_names); -kfree (clk_hw->hw.init); +kfree (init->parent_names); +kfree (init);return ; } cleanup:kfree (clk_hw->dpll_data); -kfree (clk_hw->hw.init->parent_names); -kfree (clk_hw->hw.init); +kfree (init->parent_names); +kfree (init);kfree (clk_hw); }
Signature · 1 line
Sent by a computer through tubes
Stephen Boyd
maintainerQuoting Stephen Boyd (2019-08-15 15:12:49)
Quoted 5 lines
A future patch is going to change semantics of
clk_register()so thatclk_hw::initis guaranteed to be NULL after a clk is registered. Avoid referencing this member here so that we don't run into NULL pointer exceptions.
Quoted 7 lines
Cc Tero Kristo <[email protected]>Cc Tony Lindgren <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
This might be causing boot regressions in linux-next. Not sure.
I don't see linux-next boot regressions in kernel-ci so it must be working.
Quoting Stephen Boyd (2019-08-15 15:12:49)
Quoted 9 lines
A future patch is going to change semantics of
clk_register()so thatclk_hw::initis 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 <[email protected]>Cc Tony Lindgren <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next